Merge pull request #3006 from Snaipe/remove-class
ipc: make json for view match i3's output more closely
This commit is contained in:
commit
2ccf511cba
|
@ -229,10 +229,6 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
|
||||||
json_object_object_add(object, "app_id",
|
json_object_object_add(object, "app_id",
|
||||||
app_id ? json_object_new_string(app_id) : NULL);
|
app_id ? json_object_new_string(app_id) : NULL);
|
||||||
|
|
||||||
const char *class = view_get_class(c->view);
|
|
||||||
json_object_object_add(object, "class",
|
|
||||||
class ? json_object_new_string(class) : NULL);
|
|
||||||
|
|
||||||
json_object *marks = json_object_new_array();
|
json_object *marks = json_object_new_array();
|
||||||
list_t *view_marks = c->view->marks;
|
list_t *view_marks = c->view->marks;
|
||||||
for (int i = 0; i < view_marks->length; ++i) {
|
for (int i = 0; i < view_marks->length; ++i) {
|
||||||
|
@ -269,13 +265,17 @@ 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();
|
||||||
|
|
||||||
json_object_object_add(window_props, "class",
|
const char *class = view_get_class(c->view);
|
||||||
class ? json_object_new_string(class) : NULL);
|
if (class) {
|
||||||
|
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);
|
||||||
|
@ -284,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