diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-10-28 02:20:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-28 02:20:10 +0200 |
commit | 2ccf511cbadd9eef476d42234874d0cf008311e4 (patch) | |
tree | 2d6389b38447d4bc8617f4922edce52663f09114 | |
parent | Merge pull request #3000 from Robinhuett/workspace_address_output_by_name (diff) | |
parent | ipc: make class, instance, and title window properties optional (diff) | |
download | sway-2ccf511cbadd9eef476d42234874d0cf008311e4.tar.gz sway-2ccf511cbadd9eef476d42234874d0cf008311e4.tar.zst sway-2ccf511cbadd9eef476d42234874d0cf008311e4.zip |
Merge pull request #3006 from Snaipe/remove-class
ipc: make json for view match i3's output more closely
-rw-r--r-- | sway/ipc-json.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 2cd0cb2d..5c9b3e5a 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -229,10 +229,6 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object | |||
229 | json_object_object_add(object, "app_id", | 229 | json_object_object_add(object, "app_id", |
230 | app_id ? json_object_new_string(app_id) : NULL); | 230 | app_id ? json_object_new_string(app_id) : NULL); |
231 | 231 | ||
232 | const char *class = view_get_class(c->view); | ||
233 | json_object_object_add(object, "class", | ||
234 | class ? json_object_new_string(class) : NULL); | ||
235 | |||
236 | json_object *marks = json_object_new_array(); | 232 | json_object *marks = json_object_new_array(); |
237 | list_t *view_marks = c->view->marks; | 233 | list_t *view_marks = c->view->marks; |
238 | for (int i = 0; i < view_marks->length; ++i) { | 234 | 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 | |||
269 | 265 | ||
270 | json_object *window_props = json_object_new_object(); | 266 | json_object *window_props = json_object_new_object(); |
271 | 267 | ||
272 | json_object_object_add(window_props, "class", | 268 | const char *class = view_get_class(c->view); |
273 | class ? json_object_new_string(class) : NULL); | 269 | if (class) { |
270 | json_object_object_add(window_props, "class", json_object_new_string(class)); | ||
271 | } | ||
274 | const char *instance = view_get_instance(c->view); | 272 | const char *instance = view_get_instance(c->view); |
275 | json_object_object_add(window_props, "instance", | 273 | if (instance) { |
276 | instance ? json_object_new_string(instance) : NULL); | 274 | json_object_object_add(window_props, "instance", json_object_new_string(instance)); |
277 | json_object_object_add(window_props, "title", | 275 | } |
278 | c->title ? json_object_new_string(c->title) : NULL); | 276 | if (c->title) { |
277 | json_object_object_add(window_props, "title", json_object_new_string(c->title)); | ||
278 | } | ||
279 | 279 | ||
280 | // the transient_for key is always present in i3's output | 280 | // the transient_for key is always present in i3's output |
281 | uint32_t parent_id = view_get_x11_parent_id(c->view); | 281 | 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 | |||
284 | 284 | ||
285 | const char *role = view_get_window_role(c->view); | 285 | const char *role = view_get_window_role(c->view); |
286 | if (role) { | 286 | if (role) { |
287 | json_object_object_add(window_props, "window_role", | 287 | json_object_object_add(window_props, "window_role", json_object_new_string(role)); |
288 | json_object_new_string(role)); | ||
289 | } | 288 | } |
290 | 289 | ||
291 | json_object_object_add(object, "window_properties", window_props); | 290 | json_object_object_add(object, "window_properties", window_props); |