mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 16:01:27 +00:00
Mark containers as urgent in IPC if they have urgent views
This commit is contained in:
parent
5f0a4bb6a4
commit
be28c18ad5
|
@ -316,4 +316,6 @@ void container_floating_move_to(struct sway_container *con,
|
|||
*/
|
||||
void container_set_dirty(struct sway_container *container);
|
||||
|
||||
bool container_has_urgent_child(struct sway_container *container);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -198,10 +198,9 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
|
|||
json_object_new_string(ipc_json_layout_description(c->layout)));
|
||||
}
|
||||
|
||||
if (c->type == C_VIEW) {
|
||||
json_object_object_add(object, "urgent",
|
||||
json_object_new_boolean(view_is_urgent(c->sway_view)));
|
||||
}
|
||||
bool urgent = c->type == C_VIEW ?
|
||||
view_is_urgent(c->sway_view) : container_has_urgent_child(c);
|
||||
json_object_object_add(object, "urgent", json_object_new_boolean(urgent));
|
||||
}
|
||||
|
||||
static void focus_inactive_children_iterator(struct sway_container *c, void *data) {
|
||||
|
|
|
@ -1082,3 +1082,12 @@ void container_set_dirty(struct sway_container *container) {
|
|||
container->dirty = true;
|
||||
list_add(server.dirty_containers, container);
|
||||
}
|
||||
|
||||
static bool find_urgent_iterator(struct sway_container *con,
|
||||
void *data) {
|
||||
return con->type == C_VIEW && view_is_urgent(con->sway_view);
|
||||
}
|
||||
|
||||
bool container_has_urgent_child(struct sway_container *container) {
|
||||
return container_find(container, find_urgent_iterator, NULL);
|
||||
}
|
||||
|
|
|
@ -520,13 +520,8 @@ struct sway_container *workspace_output_get_highest_available(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static bool find_urgent_iterator(struct sway_container *con,
|
||||
void *data) {
|
||||
return con->type == C_VIEW && view_is_urgent(con->sway_view);
|
||||
}
|
||||
|
||||
void workspace_detect_urgent(struct sway_container *workspace) {
|
||||
bool new_urgent = container_find(workspace, find_urgent_iterator, NULL);
|
||||
bool new_urgent = container_has_urgent_child(workspace);
|
||||
|
||||
if (workspace->sway_workspace->urgent != new_urgent) {
|
||||
workspace->sway_workspace->urgent = new_urgent;
|
||||
|
|
Loading…
Reference in a new issue