diff options
Diffstat (limited to 'sway/commands/workspace.c')
-rw-r--r-- | sway/commands/workspace.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 9ff1c97d..1e4edb38 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -182,9 +182,9 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
182 | "Can't switch workspaces while fullscreen global"); | 182 | "Can't switch workspaces while fullscreen global"); |
183 | } | 183 | } |
184 | 184 | ||
185 | bool no_auto_back_and_forth = false; | 185 | bool auto_back_and_forth = true; |
186 | while (strcasecmp(argv[0], "--no-auto-back-and-forth") == 0) { | 186 | while (strcasecmp(argv[0], "--no-auto-back-and-forth") == 0) { |
187 | no_auto_back_and_forth = true; | 187 | auto_back_and_forth = false; |
188 | if ((error = checkarg(--argc, "workspace", EXPECTED_AT_LEAST, 1))) { | 188 | if ((error = checkarg(--argc, "workspace", EXPECTED_AT_LEAST, 1))) { |
189 | return error; | 189 | return error; |
190 | } | 190 | } |
@@ -213,6 +213,9 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
213 | ws = workspace_create(NULL, name); | 213 | ws = workspace_create(NULL, name); |
214 | free(name); | 214 | free(name); |
215 | } | 215 | } |
216 | if (ws && auto_back_and_forth) { | ||
217 | ws = workspace_auto_back_and_forth(ws); | ||
218 | } | ||
216 | } else if (strcasecmp(argv[0], "next") == 0 || | 219 | } else if (strcasecmp(argv[0], "next") == 0 || |
217 | strcasecmp(argv[0], "prev") == 0 || | 220 | strcasecmp(argv[0], "prev") == 0 || |
218 | strcasecmp(argv[0], "current") == 0) { | 221 | strcasecmp(argv[0], "current") == 0) { |
@@ -235,11 +238,14 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
235 | ws = workspace_create(NULL, name); | 238 | ws = workspace_create(NULL, name); |
236 | } | 239 | } |
237 | free(name); | 240 | free(name); |
241 | if (ws && auto_back_and_forth) { | ||
242 | ws = workspace_auto_back_and_forth(ws); | ||
243 | } | ||
238 | } | 244 | } |
239 | if (!ws) { | 245 | if (!ws) { |
240 | return cmd_results_new(CMD_FAILURE, "No workspace to switch to"); | 246 | return cmd_results_new(CMD_FAILURE, "No workspace to switch to"); |
241 | } | 247 | } |
242 | workspace_switch(ws, no_auto_back_and_forth); | 248 | workspace_switch(ws); |
243 | seat_consider_warp_to_focus(seat); | 249 | seat_consider_warp_to_focus(seat); |
244 | } | 250 | } |
245 | return cmd_results_new(CMD_SUCCESS, NULL); | 251 | return cmd_results_new(CMD_SUCCESS, NULL); |