aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorAnkit Pandey <anpandey@protonmail.com>2023-03-18 04:58:53 -0700
committerRonan Pigott <ronan@rjp.ie>2023-03-24 13:20:13 -0700
commitf21090f97870af2592f801fef316984200aa6678 (patch)
tree9ff6ee98770b399c440df01fb69b7569d377771d /sway/tree
parent90c2d631e2dc4c7633bb8fcd92f300a4a2dffb86 (diff)
root: Set inactive focus when scratchpad is moved to new workspace
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.
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/root.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 233358d2..831c75a5 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -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) {
@@ -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) {