aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorLibravatar Franklin "Snaipe" Mathieu <snaipe@diacritic.io>2018-10-22 20:17:27 +0100
committerLibravatar Franklin "Snaipe" Mathieu <snaipe@diacritic.io>2018-10-23 19:10:50 +0100
commit8fc932833499552bdc8f776b8f5ba9551ae45423 (patch)
tree0fc94558441eaf6d1789801331e6280315a523f3 /sway/ipc-json.c
parentMerge pull request #2909 from makepanic/issues/2906 (diff)
downloadsway-8fc932833499552bdc8f776b8f5ba9551ae45423.tar.gz
sway-8fc932833499552bdc8f776b8f5ba9551ae45423.tar.zst
sway-8fc932833499552bdc8f776b8f5ba9551ae45423.zip
xwayland: populate window_properties in json for views
window_properties is documented to contain a subset of the X11 properties of a window (its title, class, instance, role, and transient ID). This commit adds the missing json object from the get_tree output for xwayland windows only. This is a follow-up of #2911. Signed-off-by: Franklin "Snaipe" Mathieu <me@snai.pe>
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index a29647ed..2cd0cb2d 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -266,6 +266,29 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
266 if (c->view->type == SWAY_VIEW_XWAYLAND) { 266 if (c->view->type == SWAY_VIEW_XWAYLAND) {
267 json_object_object_add(object, "window", 267 json_object_object_add(object, "window",
268 json_object_new_int(view_get_x11_window_id(c->view))); 268 json_object_new_int(view_get_x11_window_id(c->view)));
269
270 json_object *window_props = json_object_new_object();
271
272 json_object_object_add(window_props, "class",
273 class ? json_object_new_string(class) : NULL);
274 const char *instance = view_get_instance(c->view);
275 json_object_object_add(window_props, "instance",
276 instance ? json_object_new_string(instance) : NULL);
277 json_object_object_add(window_props, "title",
278 c->title ? json_object_new_string(c->title) : NULL);
279
280 // the transient_for key is always present in i3's output
281 uint32_t parent_id = view_get_x11_parent_id(c->view);
282 json_object_object_add(window_props, "transient_for",
283 parent_id ? json_object_new_int(parent_id) : NULL);
284
285 const char *role = view_get_window_role(c->view);
286 if (role) {
287 json_object_object_add(window_props, "window_role",
288 json_object_new_string(role));
289 }
290
291 json_object_object_add(object, "window_properties", window_props);
269 } 292 }
270#endif 293#endif
271} 294}