aboutsummaryrefslogtreecommitdiff
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-10-24 01:13:15 +0200
committerGitHub <noreply@github.com>2018-10-24 01:13:15 +0200
commitbdb176863c3c45caae70abb909f9eca9f611e78f (patch)
tree445c864ab22049d328dd5928a8ca3f91af325968 /sway/ipc-json.c
parent7160b8aae90694e039de8d5a9341d18c89bf3c6d (diff)
parent8fc932833499552bdc8f776b8f5ba9551ae45423 (diff)
Merge pull request #2933 from Snaipe/xwayland-window-properties
xwayland: populate window_properties in json for views
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
if (c->view->type == SWAY_VIEW_XWAYLAND) {
json_object_object_add(object, "window",
json_object_new_int(view_get_x11_window_id(c->view)));
+
+ json_object *window_props = json_object_new_object();
+
+ json_object_object_add(window_props, "class",
+ class ? json_object_new_string(class) : NULL);
+ const char *instance = view_get_instance(c->view);
+ json_object_object_add(window_props, "instance",
+ instance ? json_object_new_string(instance) : NULL);
+ json_object_object_add(window_props, "title",
+ c->title ? json_object_new_string(c->title) : NULL);
+
+ // the transient_for key is always present in i3's output
+ uint32_t parent_id = view_get_x11_parent_id(c->view);
+ json_object_object_add(window_props, "transient_for",
+ parent_id ? json_object_new_int(parent_id) : NULL);
+
+ const char *role = view_get_window_role(c->view);
+ if (role) {
+ json_object_object_add(window_props, "window_role",
+ json_object_new_string(role));
+ }
+
+ json_object_object_add(object, "window_properties", window_props);
}
#endif
}