Skip to content

Commit

Permalink
root: Set inactive focus when scratchpad is moved to new workspace
Browse files Browse the repository at this point in the history
Fixes an issue where an already visible scratchpad window being moved due to
'scratchpad show' leaves the entire workspace at the top of the focus stack in
the old workspace. Moving by 'focus output' back to the old workspace would
focus the entire workspace instead of just the last active container.
  • Loading branch information
anpandey authored and rpigott committed Mar 24, 2023
1 parent 90c2d63 commit f21090f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sway/tree/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ void root_scratchpad_show(struct sway_container *con) {
// Show the container
if (old_ws) {
container_detach(con);
workspace_consider_destroy(old_ws);
// Make sure the last inactive container on the old workspace is above
// the workspace itself in the focus stack.
struct sway_node *node = seat_get_focus_inactive(seat, &old_ws->node);
seat_set_raw_focus(seat, node);
} else {
// Act on the ancestor of scratchpad hidden split containers
while (con->pending.parent) {
Expand All @@ -163,6 +166,9 @@ void root_scratchpad_show(struct sway_container *con) {

arrange_workspace(new_ws);
seat_set_focus(seat, seat_get_focus_inactive(seat, &con->node));
if (old_ws) {
workspace_consider_destroy(old_ws);
}
}

static void disable_fullscreen(struct sway_container *con, void *data) {
Expand Down

0 comments on commit f21090f

Please sign in to comment.