summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-24 10:12:08 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-24 10:12:08 -0500
commite7c0573a980938a5174bc647faf41f24fa523b0b (patch)
treec73a877a83807b4b1f707a039aaee392d14bab6d
parentMerge pull request #248 from taiyu-len/master (diff)
parentcontainer: Store app_id attribute for views. (diff)
downloadsway-e7c0573a980938a5174bc647faf41f24fa523b0b.tar.gz
sway-e7c0573a980938a5174bc647faf41f24fa523b0b.tar.zst
sway-e7c0573a980938a5174bc647faf41f24fa523b0b.zip
Merge pull request #249 from sce/extra_view_metadata
Extra view metadata
-rw-r--r--include/container.h3
-rw-r--r--sway/container.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/include/container.h b/include/container.h
index cb18de49..7b0bdb78 100644
--- a/include/container.h
+++ b/include/container.h
@@ -75,7 +75,10 @@ struct sway_container {
75 bool is_floating; 75 bool is_floating;
76 bool is_focused; 76 bool is_focused;
77 77
78 // Attributes that mostly views have.
78 char *name; 79 char *name;
80 char *class;
81 char *app_id;
79 82
80 int gaps; 83 int gaps;
81 84
diff --git a/sway/container.c b/sway/container.c
index bbe2e7b0..1634cce0 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -50,6 +50,12 @@ static void free_swayc(swayc_t *cont) {
50 if (cont->name) { 50 if (cont->name) {
51 free(cont->name); 51 free(cont->name);
52 } 52 }
53 if (cont->class) {
54 free(cont->class);
55 }
56 if (cont->app_id) {
57 free(cont->app_id);
58 }
53 free(cont); 59 free(cont);
54} 60}
55 61
@@ -214,6 +220,10 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) {
214 // Setup values 220 // Setup values
215 view->handle = handle; 221 view->handle = handle;
216 view->name = title ? strdup(title) : NULL; 222 view->name = title ? strdup(title) : NULL;
223 const char *class = wlc_view_get_class(handle);
224 view->class = class ? strdup(class) : NULL;
225 const char *app_id = wlc_view_get_app_id(handle);
226 view->app_id = app_id ? strdup(app_id) : NULL;
217 view->visible = true; 227 view->visible = true;
218 view->is_focused = true; 228 view->is_focused = true;
219 // Setup geometry 229 // Setup geometry
@@ -246,6 +256,10 @@ swayc_t *new_floating_view(wlc_handle handle) {
246 // Setup values 256 // Setup values
247 view->handle = handle; 257 view->handle = handle;
248 view->name = title ? strdup(title) : NULL; 258 view->name = title ? strdup(title) : NULL;
259 const char *class = wlc_view_get_class(handle);
260 view->class = class ? strdup(class) : NULL;
261 const char *app_id = wlc_view_get_app_id(handle);
262 view->app_id = app_id ? strdup(app_id) : NULL;
249 view->visible = true; 263 view->visible = true;
250 264
251 // Set the geometry of the floating view 265 // Set the geometry of the floating view