diff options
-rw-r--r-- | sway/ipc-server.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index c3b589a6..872c5704 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -379,22 +379,23 @@ void ipc_client_disconnect(struct ipc_client *client) { | |||
379 | } | 379 | } |
380 | 380 | ||
381 | static void ipc_get_workspaces_callback(swayc_t *workspace, void *data) { | 381 | static void ipc_get_workspaces_callback(swayc_t *workspace, void *data) { |
382 | if (workspace->type == C_WORKSPACE) { | 382 | if (workspace->type != C_WORKSPACE) { |
383 | json_object *workspace_json = ipc_json_describe_container(workspace); | 383 | return; |
384 | // override the default focused indicator because | ||
385 | // it's set differently for the get_workspaces reply | ||
386 | struct sway_seat *seat = | ||
387 | sway_input_manager_get_default_seat(input_manager); | ||
388 | swayc_t *focused_ws = sway_seat_get_focus(seat); | ||
389 | if (focused_ws->type != C_WORKSPACE) { | ||
390 | focused_ws = swayc_parent_by_type(focused_ws, C_WORKSPACE); | ||
391 | } | ||
392 | bool focused = workspace == focused_ws; | ||
393 | json_object_object_del(workspace_json, "focused"); | ||
394 | json_object_object_add(workspace_json, "focused", | ||
395 | json_object_new_boolean(focused)); | ||
396 | json_object_array_add((json_object *)data, workspace_json); | ||
397 | } | 384 | } |
385 | json_object *workspace_json = ipc_json_describe_container(workspace); | ||
386 | // override the default focused indicator because | ||
387 | // it's set differently for the get_workspaces reply | ||
388 | struct sway_seat *seat = | ||
389 | sway_input_manager_get_default_seat(input_manager); | ||
390 | swayc_t *focused_ws = sway_seat_get_focus(seat); | ||
391 | if (focused_ws->type != C_WORKSPACE) { | ||
392 | focused_ws = swayc_parent_by_type(focused_ws, C_WORKSPACE); | ||
393 | } | ||
394 | bool focused = workspace == focused_ws; | ||
395 | json_object_object_del(workspace_json, "focused"); | ||
396 | json_object_object_add(workspace_json, "focused", | ||
397 | json_object_new_boolean(focused)); | ||
398 | json_object_array_add((json_object *)data, workspace_json); | ||
398 | } | 399 | } |
399 | 400 | ||
400 | void ipc_client_handle_command(struct ipc_client *client) { | 401 | void ipc_client_handle_command(struct ipc_client *client) { |