mirror of
https://github.com/swaywm/sway.git
synced 2025-11-17 06:59:48 -05:00
Update workspace urgent state when views close or move workspaces
This commit is contained in:
parent
560627437b
commit
5f0a4bb6a4
6 changed files with 31 additions and 7 deletions
|
|
@ -1070,6 +1070,8 @@ void container_floating_move_to(struct sway_container *con,
|
|||
container_add_child(new_workspace->sway_workspace->floating, con);
|
||||
arrange_windows(old_workspace);
|
||||
arrange_windows(new_workspace);
|
||||
workspace_detect_urgent(old_workspace);
|
||||
workspace_detect_urgent(new_workspace);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,6 +225,15 @@ void container_move_to(struct sway_container *container,
|
|||
}
|
||||
}
|
||||
}
|
||||
// Update workspace urgent state
|
||||
struct sway_container *old_workspace = old_parent;
|
||||
if (old_workspace->type != C_WORKSPACE) {
|
||||
old_workspace = container_parent(old_workspace, C_WORKSPACE);
|
||||
}
|
||||
if (new_workspace != old_workspace) {
|
||||
workspace_detect_urgent(new_workspace);
|
||||
workspace_detect_urgent(old_workspace);
|
||||
}
|
||||
}
|
||||
|
||||
static bool sway_dir_to_wlr(enum movement_direction dir,
|
||||
|
|
@ -548,6 +557,8 @@ void container_move(struct sway_container *container,
|
|||
}
|
||||
if (last_ws && next_ws && last_ws != next_ws) {
|
||||
ipc_event_workspace(last_ws, container, "focus");
|
||||
workspace_detect_urgent(last_ws);
|
||||
workspace_detect_urgent(next_ws);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -595,16 +595,21 @@ void view_unmap(struct sway_view *view) {
|
|||
view->urgent_timer = NULL;
|
||||
}
|
||||
|
||||
struct sway_container *parent;
|
||||
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
|
||||
|
||||
if (view->is_fullscreen) {
|
||||
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
|
||||
ws->sway_workspace->fullscreen = NULL;
|
||||
container_destroy(view->swayc);
|
||||
parent = container_destroy(view->swayc);
|
||||
|
||||
arrange_windows(ws->parent);
|
||||
} else {
|
||||
struct sway_container *parent = container_destroy(view->swayc);
|
||||
arrange_windows(parent);
|
||||
}
|
||||
if (parent->type >= C_WORKSPACE) { // if the workspace still exists
|
||||
workspace_detect_urgent(ws);
|
||||
}
|
||||
transaction_commit_dirty();
|
||||
view->surface = NULL;
|
||||
}
|
||||
|
|
@ -1073,7 +1078,7 @@ void view_set_urgent(struct sway_view *view, bool enable) {
|
|||
ipc_event_window(view->swayc, "urgent");
|
||||
|
||||
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
|
||||
ipc_event_workspace(NULL, ws, "urgent");
|
||||
workspace_detect_urgent(ws);
|
||||
}
|
||||
|
||||
bool view_is_urgent(struct sway_view *view) {
|
||||
|
|
|
|||
|
|
@ -525,6 +525,11 @@ static bool find_urgent_iterator(struct sway_container *con,
|
|||
return con->type == C_VIEW && view_is_urgent(con->sway_view);
|
||||
}
|
||||
|
||||
bool workspace_is_urgent(struct sway_container *workspace) {
|
||||
return container_find(workspace, find_urgent_iterator, NULL);
|
||||
void workspace_detect_urgent(struct sway_container *workspace) {
|
||||
bool new_urgent = container_find(workspace, find_urgent_iterator, NULL);
|
||||
|
||||
if (workspace->sway_workspace->urgent != new_urgent) {
|
||||
workspace->sway_workspace->urgent = new_urgent;
|
||||
ipc_event_workspace(NULL, workspace, "urgent");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue