diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-08-04 15:36:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-04 15:36:29 -0400 |
commit | f773eb96a80d3da63a99cb3def43db6d0a0cf4d5 (patch) | |
tree | 41c02c9ba8c37ec4a0d8353931852efd1104ab8c | |
parent | 4b0de51766f78b1783528a43fe56300c7f4b50f2 (diff) | |
parent | 132017d242a5d0974144d0e8e4ba063bab256d6b (diff) | |
download | sway-f773eb96a80d3da63a99cb3def43db6d0a0cf4d5.tar.xz |
Merge pull request #832 from thejan2009/bug/workspace-back-and-forth
Fix 'workspace back_and_forth' and workspace_auto_back_and_forth clash
-rw-r--r-- | sway/commands.c | 11 |
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) { } else if (strcasecmp(argv[0], "prev_on_output") == 0) { ws = workspace_output_prev(); } else if (strcasecmp(argv[0], "back_and_forth") == 0) { - if (prev_workspace_name) { - if (!(ws = workspace_by_name(prev_workspace_name))) { - ws = workspace_create(prev_workspace_name); - } + // if auto_back_and_forth is enabled, workspace_switch will swap + // the workspaces. If we created prev_workspace here, workspace_switch + // would put us back on original workspace. + if (config->auto_back_and_forth) { + ws = swayc_active_workspace(); + } else if (prev_workspace_name && !(ws = workspace_by_name(prev_workspace_name))) { + ws = workspace_create(prev_workspace_name); } } else { if (!(ws = workspace_by_name(argv[0]))) { |