summaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 2cd0cb2d..7cc965c8 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -136,13 +136,18 @@ static void ipc_json_describe_output(struct sway_output *output,
136 json_object_new_int(mode->width)); 136 json_object_new_int(mode->width));
137 json_object_object_add(mode_object, "height", 137 json_object_object_add(mode_object, "height",
138 json_object_new_int(mode->height)); 138 json_object_new_int(mode->height));
139 json_object_object_add(mode_object, "refresh",
140 json_object_new_int(mode->refresh));
141 json_object_array_add(modes_array, mode_object); 139 json_object_array_add(modes_array, mode_object);
142 } 140 }
143 141
144 json_object_object_add(object, "modes", modes_array); 142 json_object_object_add(object, "modes", modes_array);
145 143
144 json_object *current_mode_object = json_object_new_object();
145 json_object_object_add(current_mode_object, "width",
146 json_object_new_int(wlr_output->width));
147 json_object_object_add(current_mode_object, "height",
148 json_object_new_int(wlr_output->height));
149 json_object_object_add(object, "current_mode", current_mode_object);
150
146 struct sway_node *parent = node_get_parent(&output->node); 151 struct sway_node *parent = node_get_parent(&output->node);
147 struct wlr_box parent_box = {0, 0, 0, 0}; 152 struct wlr_box parent_box = {0, 0, 0, 0};
148 153
@@ -229,14 +234,10 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
229 json_object_object_add(object, "app_id", 234 json_object_object_add(object, "app_id",
230 app_id ? json_object_new_string(app_id) : NULL); 235 app_id ? json_object_new_string(app_id) : NULL);
231 236
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(); 237 json_object *marks = json_object_new_array();
237 list_t *view_marks = c->view->marks; 238 list_t *con_marks = c->marks;
238 for (int i = 0; i < view_marks->length; ++i) { 239 for (int i = 0; i < con_marks->length; ++i) {
239 json_object_array_add(marks, json_object_new_string(view_marks->items[i])); 240 json_object_array_add(marks, json_object_new_string(con_marks->items[i]));
240 } 241 }
241 242
242 json_object_object_add(object, "marks", marks); 243 json_object_object_add(object, "marks", marks);
@@ -269,13 +270,17 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
269 270
270 json_object *window_props = json_object_new_object(); 271 json_object *window_props = json_object_new_object();
271 272
272 json_object_object_add(window_props, "class", 273 const char *class = view_get_class(c->view);
273 class ? json_object_new_string(class) : NULL); 274 if (class) {
275 json_object_object_add(window_props, "class", json_object_new_string(class));
276 }
274 const char *instance = view_get_instance(c->view); 277 const char *instance = view_get_instance(c->view);
275 json_object_object_add(window_props, "instance", 278 if (instance) {
276 instance ? json_object_new_string(instance) : NULL); 279 json_object_object_add(window_props, "instance", json_object_new_string(instance));
277 json_object_object_add(window_props, "title", 280 }
278 c->title ? json_object_new_string(c->title) : NULL); 281 if (c->title) {
282 json_object_object_add(window_props, "title", json_object_new_string(c->title));
283 }
279 284
280 // the transient_for key is always present in i3's output 285 // the transient_for key is always present in i3's output
281 uint32_t parent_id = view_get_x11_parent_id(c->view); 286 uint32_t parent_id = view_get_x11_parent_id(c->view);
@@ -284,8 +289,7 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
284 289
285 const char *role = view_get_window_role(c->view); 290 const char *role = view_get_window_role(c->view);
286 if (role) { 291 if (role) {
287 json_object_object_add(window_props, "window_role", 292 json_object_object_add(window_props, "window_role", json_object_new_string(role));
288 json_object_new_string(role));
289 } 293 }
290 294
291 json_object_object_add(object, "window_properties", window_props); 295 json_object_object_add(object, "window_properties", window_props);