diff --git a/sway/ipc-json.c b/sway/ipc-json.c index c7cbea01..f770e984 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -506,6 +506,8 @@ static void ipc_json_describe_workspace(struct sway_workspace *workspace, json_object_new_string(workspace->output->wlr_output->name) : NULL); json_object_object_add(object, "urgent", json_object_new_boolean(workspace->urgent)); + json_object_object_add(object, "empty", + json_object_new_boolean(workspace_is_empty(workspace))); json_object_object_add(object, "representation", workspace->representation ? json_object_new_string(workspace->representation) : NULL); diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 33ae6544..18dfd7ad 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -355,7 +355,7 @@ bool ipc_get_workspaces(struct swaybar *bar) { bar->visible_by_urgency = false; size_t length = json_object_array_length(results); json_object *ws_json; - json_object *num, *name, *visible, *focused, *out, *urgent; + json_object *num, *name, *visible, *focused, *out, *urgent, *empty; for (size_t i = 0; i < length; ++i) { ws_json = json_object_array_get_idx(results, i); @@ -365,6 +365,7 @@ bool ipc_get_workspaces(struct swaybar *bar) { json_object_object_get_ex(ws_json, "focused", &focused); json_object_object_get_ex(ws_json, "output", &out); json_object_object_get_ex(ws_json, "urgent", &urgent); + json_object_object_get_ex(ws_json, "empty", &empty); wl_list_for_each(output, &bar->outputs, link) { const char *ws_output = json_object_get_string(out); @@ -399,6 +400,7 @@ bool ipc_get_workspaces(struct swaybar *bar) { if (ws->urgent) { bar->visible_by_urgency = true; } + ws->empty = json_object_get_boolean(empty); wl_list_insert(output->workspaces.prev, &ws->link); } }