mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 00:16:22 +01:00
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
1 changed files with 11 additions and 12 deletions
|
@ -229,10 +229,6 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
|
|||
json_object_object_add(object, "app_id",
|
||||
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();
|
||||
list_t *view_marks = c->view->marks;
|
||||
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_object_add(window_props, "class",
|
||||
class ? json_object_new_string(class) : NULL);
|
||||
const char *class = view_get_class(c->view);
|
||||
if (class) {
|
||||
json_object_object_add(window_props, "class", json_object_new_string(class));
|
||||
}
|
||||
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);
|
||||
if (instance) {
|
||||
json_object_object_add(window_props, "instance", json_object_new_string(instance));
|
||||
}
|
||||
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
|
||||
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);
|
||||
if (role) {
|
||||
json_object_object_add(window_props, "window_role",
|
||||
json_object_new_string(role));
|
||||
json_object_object_add(window_props, "window_role", json_object_new_string(role));
|
||||
}
|
||||
|
||||
json_object_object_add(object, "window_properties", window_props);
|
||||
|
|
Loading…
Reference in a new issue