diff options
-rw-r--r-- | sway/ipc-server.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 6466d263..aa0f0fad 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -619,8 +619,19 @@ void ipc_client_handle_command(struct ipc_client *client) { | |||
619 | json_object *outputs = json_object_new_array(); | 619 | json_object *outputs = json_object_new_array(); |
620 | for (int i = 0; i < root->outputs->length; ++i) { | 620 | for (int i = 0; i < root->outputs->length; ++i) { |
621 | struct sway_output *output = root->outputs->items[i]; | 621 | struct sway_output *output = root->outputs->items[i]; |
622 | json_object_array_add(outputs, | 622 | json_object *output_json = ipc_json_describe_node(&output->node); |
623 | ipc_json_describe_node(&output->node)); | 623 | |
624 | // override the default focused indicator because it's set | ||
625 | // differently for the get_outputs reply | ||
626 | struct sway_seat *seat = input_manager_get_default_seat(); | ||
627 | struct sway_workspace *focused_ws = | ||
628 | seat_get_focused_workspace(seat); | ||
629 | bool focused = focused_ws && output == focused_ws->output; | ||
630 | json_object_object_del(output_json, "focused"); | ||
631 | json_object_object_add(output_json, "focused", | ||
632 | json_object_new_boolean(focused)); | ||
633 | |||
634 | json_object_array_add(outputs, output_json); | ||
624 | } | 635 | } |
625 | struct sway_output *output; | 636 | struct sway_output *output; |
626 | wl_list_for_each(output, &root->all_outputs, link) { | 637 | wl_list_for_each(output, &root->all_outputs, link) { |