mirror of
https://github.com/swaywm/sway.git
synced 2024-11-28 02:41:28 +00:00
Implement empty
flag for workspaces in ipc
This commit is contained in:
parent
f57149dedd
commit
d3ac856688
|
@ -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_new_string(workspace->output->wlr_output->name) : NULL);
|
||||||
json_object_object_add(object, "urgent",
|
json_object_object_add(object, "urgent",
|
||||||
json_object_new_boolean(workspace->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_object_add(object, "representation", workspace->representation ?
|
||||||
json_object_new_string(workspace->representation) : NULL);
|
json_object_new_string(workspace->representation) : NULL);
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,7 @@ bool ipc_get_workspaces(struct swaybar *bar) {
|
||||||
bar->visible_by_urgency = false;
|
bar->visible_by_urgency = false;
|
||||||
size_t length = json_object_array_length(results);
|
size_t length = json_object_array_length(results);
|
||||||
json_object *ws_json;
|
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) {
|
for (size_t i = 0; i < length; ++i) {
|
||||||
ws_json = json_object_array_get_idx(results, 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, "focused", &focused);
|
||||||
json_object_object_get_ex(ws_json, "output", &out);
|
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, "urgent", &urgent);
|
||||||
|
json_object_object_get_ex(ws_json, "empty", &empty);
|
||||||
|
|
||||||
wl_list_for_each(output, &bar->outputs, link) {
|
wl_list_for_each(output, &bar->outputs, link) {
|
||||||
const char *ws_output = json_object_get_string(out);
|
const char *ws_output = json_object_get_string(out);
|
||||||
|
@ -399,6 +400,7 @@ bool ipc_get_workspaces(struct swaybar *bar) {
|
||||||
if (ws->urgent) {
|
if (ws->urgent) {
|
||||||
bar->visible_by_urgency = true;
|
bar->visible_by_urgency = true;
|
||||||
}
|
}
|
||||||
|
ws->empty = json_object_get_boolean(empty);
|
||||||
wl_list_insert(output->workspaces.prev, &ws->link);
|
wl_list_insert(output->workspaces.prev, &ws->link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue