aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/move.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r--sway/commands/move.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 500151f7..af3dc538 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -107,8 +107,13 @@ static struct cmd_results *cmd_move_container(struct sway_container *current,
strcasecmp(argv[2], "current") == 0) {
ws = workspace_by_name(argv[2]);
} else if (strcasecmp(argv[2], "back_and_forth") == 0) {
- if (!(ws = workspace_by_name(argv[0])) && prev_workspace_name) {
- ws = workspace_create(NULL, prev_workspace_name);
+ if (!(ws = workspace_by_name(argv[2]))) {
+ if (prev_workspace_name) {
+ ws = workspace_create(NULL, prev_workspace_name);
+ } else {
+ return cmd_results_new(CMD_FAILURE, "move",
+ "No workspace was previously active.");
+ }
}
} else {
char *ws_name = NULL;