swaybar: show hidden bar on urgency
This commit is contained in:
parent
2f1fd80726
commit
f6f72cb949
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
bool ipc_initialize(struct swaybar *bar);
|
bool ipc_initialize(struct swaybar *bar);
|
||||||
bool handle_ipc_readable(struct swaybar *bar);
|
bool handle_ipc_readable(struct swaybar *bar);
|
||||||
void ipc_get_workspaces(struct swaybar *bar);
|
bool ipc_get_workspaces(struct swaybar *bar);
|
||||||
void ipc_send_workspace_command(struct swaybar *bar, const char *ws);
|
void ipc_send_workspace_command(struct swaybar *bar, const char *ws);
|
||||||
void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind);
|
void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind);
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ static bool ipc_parse_config(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ipc_get_workspaces(struct swaybar *bar) {
|
bool ipc_get_workspaces(struct swaybar *bar) {
|
||||||
struct swaybar_output *output;
|
struct swaybar_output *output;
|
||||||
wl_list_for_each(output, &bar->outputs, link) {
|
wl_list_for_each(output, &bar->outputs, link) {
|
||||||
free_workspaces(&output->workspaces);
|
free_workspaces(&output->workspaces);
|
||||||
|
@ -274,8 +274,10 @@ void ipc_get_workspaces(struct swaybar *bar) {
|
||||||
json_object *results = json_tokener_parse(res);
|
json_object *results = json_tokener_parse(res);
|
||||||
if (!results) {
|
if (!results) {
|
||||||
free(res);
|
free(res);
|
||||||
return;
|
return 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;
|
||||||
|
@ -302,12 +304,16 @@ void ipc_get_workspaces(struct swaybar *bar) {
|
||||||
output->focused = true;
|
output->focused = true;
|
||||||
}
|
}
|
||||||
ws->urgent = json_object_get_boolean(urgent);
|
ws->urgent = json_object_get_boolean(urgent);
|
||||||
|
if (ws->urgent) {
|
||||||
|
bar->visible_by_urgency = true;
|
||||||
|
}
|
||||||
wl_list_insert(&output->workspaces, &ws->link);
|
wl_list_insert(&output->workspaces, &ws->link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json_object_put(results);
|
json_object_put(results);
|
||||||
free(res);
|
free(res);
|
||||||
|
return determine_bar_visibility(bar, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ipc_get_outputs(struct swaybar *bar) {
|
static void ipc_get_outputs(struct swaybar *bar) {
|
||||||
|
@ -436,7 +442,7 @@ bool handle_ipc_readable(struct swaybar *bar) {
|
||||||
bool bar_is_dirty = true;
|
bool bar_is_dirty = true;
|
||||||
switch (resp->type) {
|
switch (resp->type) {
|
||||||
case IPC_EVENT_WORKSPACE:
|
case IPC_EVENT_WORKSPACE:
|
||||||
ipc_get_workspaces(bar);
|
bar_is_dirty = ipc_get_workspaces(bar);
|
||||||
break;
|
break;
|
||||||
case IPC_EVENT_MODE: {
|
case IPC_EVENT_MODE: {
|
||||||
json_object *json_change, *json_pango_markup;
|
json_object *json_change, *json_pango_markup;
|
||||||
|
|
Loading…
Reference in a new issue