mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 08:21:28 +00:00
ipc: make class, instance, and title window properties optional
i3 seems to make all window properties, with the exception of
transient_for, optional[1].
[1]: 315ff17563/src/ipc.c (L435-L450)
Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io>
This commit is contained in:
parent
259fe1e76f
commit
03ca8596d6
|
@ -266,13 +266,16 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
|
||||||
json_object *window_props = json_object_new_object();
|
json_object *window_props = json_object_new_object();
|
||||||
|
|
||||||
const char *class = view_get_class(c->view);
|
const char *class = view_get_class(c->view);
|
||||||
json_object_object_add(window_props, "class",
|
if (class) {
|
||||||
class ? json_object_new_string(class) : NULL);
|
json_object_object_add(window_props, "class", json_object_new_string(class));
|
||||||
|
}
|
||||||
const char *instance = view_get_instance(c->view);
|
const char *instance = view_get_instance(c->view);
|
||||||
json_object_object_add(window_props, "instance",
|
if (instance) {
|
||||||
instance ? json_object_new_string(instance) : NULL);
|
json_object_object_add(window_props, "instance", json_object_new_string(instance));
|
||||||
json_object_object_add(window_props, "title",
|
}
|
||||||
c->title ? json_object_new_string(c->title) : NULL);
|
if (c->title) {
|
||||||
|
json_object_object_add(window_props, "title", json_object_new_string(c->title));
|
||||||
|
}
|
||||||
|
|
||||||
// the transient_for key is always present in i3's output
|
// the transient_for key is always present in i3's output
|
||||||
uint32_t parent_id = view_get_x11_parent_id(c->view);
|
uint32_t parent_id = view_get_x11_parent_id(c->view);
|
||||||
|
@ -281,8 +284,7 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
|
||||||
|
|
||||||
const char *role = view_get_window_role(c->view);
|
const char *role = view_get_window_role(c->view);
|
||||||
if (role) {
|
if (role) {
|
||||||
json_object_object_add(window_props, "window_role",
|
json_object_object_add(window_props, "window_role", json_object_new_string(role));
|
||||||
json_object_new_string(role));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
json_object_object_add(object, "window_properties", window_props);
|
json_object_object_add(object, "window_properties", window_props);
|
||||||
|
|
Loading…
Reference in a new issue