Skip to content

Commit

Permalink
xwayland: populate window_properties in json for views
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Snaipe committed Oct 22, 2018
1 parent 4297875 commit 56d373c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sway/ipc-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,23 @@ 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);
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
}
Expand Down

0 comments on commit 56d373c

Please sign in to comment.