diff options
author | emersion <contact@emersion.fr> | 2018-11-22 09:16:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-22 09:16:14 +0100 |
commit | 77554f545e1b386ae0f4896bdf4c817524a15e60 (patch) | |
tree | 1d26a7edb33a6c8560b4e50ce3c3d4e45fd8877d /sway/ipc-server.c | |
parent | d63f9028d717ce6c28d4ef943266819344af706c (diff) | |
parent | 2f1050796cdef7973c3ede41b39718a3e5e7a679 (diff) |
Merge pull request #3158 from emersion/get-outputs-focused
ipc: fix focused in get_outputs reply
Diffstat (limited to 'sway/ipc-server.c')
-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) { json_object *outputs = json_object_new_array(); for (int i = 0; i < root->outputs->length; ++i) { struct sway_output *output = root->outputs->items[i]; - json_object_array_add(outputs, - ipc_json_describe_node(&output->node)); + json_object *output_json = ipc_json_describe_node(&output->node); + + // override the default focused indicator because it's set + // differently for the get_outputs reply + struct sway_seat *seat = input_manager_get_default_seat(); + struct sway_workspace *focused_ws = + seat_get_focused_workspace(seat); + bool focused = focused_ws && output == focused_ws->output; + json_object_object_del(output_json, "focused"); + json_object_object_add(output_json, "focused", + json_object_new_boolean(focused)); + + json_object_array_add(outputs, output_json); } struct sway_output *output; wl_list_for_each(output, &root->all_outputs, link) { |