summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
authorLibravatar D.B <thejan.2009@gmail.com>2016-08-04 21:16:54 +0200
committerLibravatar D.B <thejan.2009@gmail.com>2016-08-04 21:31:46 +0200
commit132017d242a5d0974144d0e8e4ba063bab256d6b (patch)
tree41c02c9ba8c37ec4a0d8353931852efd1104ab8c /sway/commands.c
parentMerge pull request #831 from progandy/fix_colors (diff)
downloadsway-132017d242a5d0974144d0e8e4ba063bab256d6b.tar.gz
sway-132017d242a5d0974144d0e8e4ba063bab256d6b.tar.zst
sway-132017d242a5d0974144d0e8e4ba063bab256d6b.zip
Fix 'workspace back_and_forth' and workspace_auto_back_and_forth clash
When workspace_auto_back_and_forth is enabled, workspaces get switched twice with previously mentioned command, which is not the expected behavior. Removes one redundant creation of previous workspace.
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c
index f73bd21c..172f9f34 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -2563,10 +2563,13 @@ static struct cmd_results *cmd_workspace(int argc, char **argv) {
2563 } else if (strcasecmp(argv[0], "prev_on_output") == 0) { 2563 } else if (strcasecmp(argv[0], "prev_on_output") == 0) {
2564 ws = workspace_output_prev(); 2564 ws = workspace_output_prev();
2565 } else if (strcasecmp(argv[0], "back_and_forth") == 0) { 2565 } else if (strcasecmp(argv[0], "back_and_forth") == 0) {
2566 if (prev_workspace_name) { 2566 // if auto_back_and_forth is enabled, workspace_switch will swap
2567 if (!(ws = workspace_by_name(prev_workspace_name))) { 2567 // the workspaces. If we created prev_workspace here, workspace_switch
2568 ws = workspace_create(prev_workspace_name); 2568 // would put us back on original workspace.
2569 } 2569 if (config->auto_back_and_forth) {
2570 ws = swayc_active_workspace();
2571 } else if (prev_workspace_name && !(ws = workspace_by_name(prev_workspace_name))) {
2572 ws = workspace_create(prev_workspace_name);
2570 } 2573 }
2571 } else { 2574 } else {
2572 if (!(ws = workspace_by_name(argv[0]))) { 2575 if (!(ws = workspace_by_name(argv[0]))) {