aboutsummaryrefslogtreecommitdiff
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,
json_object_new_int(mode->width));
json_object_object_add(mode_object, "height",
json_object_new_int(mode->height));
- json_object_object_add(mode_object, "refresh",
- json_object_new_int(mode->refresh));
json_object_array_add(modes_array, mode_object);
}
json_object_object_add(object, "modes", modes_array);
+ json_object *current_mode_object = json_object_new_object();
+ json_object_object_add(current_mode_object, "width",
+ json_object_new_int(wlr_output->width));
+ json_object_object_add(current_mode_object, "height",
+ json_object_new_int(wlr_output->height));
+ json_object_object_add(object, "current_mode", current_mode_object);
+
struct sway_node *parent = node_get_parent(&output->node);
struct wlr_box parent_box = {0, 0, 0, 0};
@@ -229,14 +234,10 @@ 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) {
- json_object_array_add(marks, json_object_new_string(view_marks->items[i]));
+ list_t *con_marks = c->marks;
+ for (int i = 0; i < con_marks->length; ++i) {
+ json_object_array_add(marks, json_object_new_string(con_marks->items[i]));
}
json_object_object_add(object, "marks", marks);
@@ -269,13 +270,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 +289,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);