aboutsummaryrefslogtreecommitdiff
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-03-30 19:04:06 -0400
committeremersion <contact@emersion.fr>2018-03-30 19:04:06 -0400
commit96656427656118f2e4d725359cc880270b0e51be (patch)
treee2596e9cfa113efa43f2a411176c31e6208a58b1 /sway/ipc-server.c
parent6c9d67b1059409750de683aec3b8b9be2da987cc (diff)
parent1b88eaee6b14987c585fcf149cc26f665c584d77 (diff)
Merge branch 'wlroots' into client-cursors
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 394161af..869f1ed0 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -390,7 +390,7 @@ static void ipc_get_workspaces_callback(struct sway_container *workspace,
struct sway_seat *seat =
sway_input_manager_get_default_seat(input_manager);
struct sway_container *focused_ws = sway_seat_get_focus(seat);
- if (focused_ws->type != C_WORKSPACE) {
+ if (focused_ws != NULL && focused_ws->type != C_WORKSPACE) {
focused_ws = container_parent(focused_ws, C_WORKSPACE);
}
bool focused = workspace == focused_ws;
@@ -398,6 +398,14 @@ static void ipc_get_workspaces_callback(struct sway_container *workspace,
json_object_object_add(workspace_json, "focused",
json_object_new_boolean(focused));
json_object_array_add((json_object *)data, workspace_json);
+
+ focused_ws = sway_seat_get_focus_inactive(seat, workspace->parent);
+ if (focused_ws->type != C_WORKSPACE) {
+ focused_ws = container_parent(focused_ws, C_WORKSPACE);
+ }
+ bool visible = workspace == focused_ws;
+ json_object_object_add(workspace_json, "visible",
+ json_object_new_boolean(visible));
}
void ipc_client_handle_command(struct ipc_client *client) {