diff options
author | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-11-22 22:05:00 +0100 |
---|---|---|
committer | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-11-24 16:00:41 +0100 |
commit | 47c313fe3e8f66dafbebd4d00c143ac4a49c5c2d (patch) | |
tree | b441ff0caf59e7a741858fa2c6ac7c076ae5e07a | |
parent | c671329681550e0b92aabafd284f9c508511714e (diff) | |
download | sway-47c313fe3e8f66dafbebd4d00c143ac4a49c5c2d.tar.xz |
container: Store class attribute for views.
-rw-r--r-- | include/container.h | 2 | ||||
-rw-r--r-- | sway/container.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/container.h b/include/container.h index cb18de49..c2953eec 100644 --- a/include/container.h +++ b/include/container.h @@ -75,7 +75,9 @@ struct sway_container { bool is_floating; bool is_focused; + // Attributes that mostly views have. char *name; + char *class; int gaps; diff --git a/sway/container.c b/sway/container.c index bbe2e7b0..5bf59c26 100644 --- a/sway/container.c +++ b/sway/container.c @@ -50,6 +50,9 @@ static void free_swayc(swayc_t *cont) { if (cont->name) { free(cont->name); } + if (cont->class) { + free(cont->class); + } free(cont); } @@ -214,6 +217,8 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { // Setup values view->handle = handle; view->name = title ? strdup(title) : NULL; + const char *class = wlc_view_get_class(handle); + view->class = class ? strdup(class) : NULL; view->visible = true; view->is_focused = true; // Setup geometry @@ -246,6 +251,8 @@ swayc_t *new_floating_view(wlc_handle handle) { // Setup values view->handle = handle; view->name = title ? strdup(title) : NULL; + const char *class = wlc_view_get_class(handle); + view->class = class ? strdup(class) : NULL; view->visible = true; // Set the geometry of the floating view |