aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
authorLibravatar Ragnar Groot Koerkamp <ragnar.grootkoerkamp@gmail.com>2021-06-18 13:13:21 +0200
committerLibravatar Simon Ser <contact@emersion.fr>2021-06-18 16:15:02 +0200
commitd5c71231e5d17db9f33284f6c4f16aeb2e3ec2a6 (patch)
tree090844544be2b9e8cc0c1b918db04d1529ced4cb /sway/tree/workspace.c
parentMove auto_back_and_forth logic out of workspace_switch (diff)
downloadsway-d5c71231e5d17db9f33284f6c4f16aeb2e3ec2a6.tar.gz
sway-d5c71231e5d17db9f33284f6c4f16aeb2e3ec2a6.tar.zst
sway-d5c71231e5d17db9f33284f6c4f16aeb2e3ec2a6.zip
Only call workspace_auto_back_and_forth when needed
Instead of disabling it for some workspace subcommands, this explicitly calls it only in the 2 places it's actually needed: for switching to a named or numbered workspace.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 2dbd6346..7e98dc92 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -572,12 +572,13 @@ struct sway_workspace *workspace_auto_back_and_forth(
572 active_ws = focus->sway_container->pending.workspace; 572 active_ws = focus->sway_container->pending.workspace;
573 } 573 }
574 574
575 if (config->auto_back_and_forth && active_ws && 575 if (config->auto_back_and_forth && active_ws && active_ws == workspace &&
576 active_ws == workspace && seat->prev_workspace_name) { 576 seat->prev_workspace_name) {
577 struct sway_workspace *new_ws = 577 struct sway_workspace *new_ws =
578 workspace_by_name(seat->prev_workspace_name); 578 workspace_by_name(seat->prev_workspace_name);
579 workspace = new_ws ? new_ws 579 workspace = new_ws ?
580 : workspace_create(NULL, seat->prev_workspace_name); 580 new_ws :
581 workspace_create(NULL, seat->prev_workspace_name);
581 } 582 }
582 return workspace; 583 return workspace;
583} 584}