aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/move.c
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2018-08-06 12:46:28 +0100
committerIan Fan <ianfan0@gmail.com>2018-08-06 14:17:58 +0100
commitf7c21451dfa7c4ffdce1307b5856707a0ed40405 (patch)
tree3df803a95c0a13f4dc9b627db505ba50d5e6a6d2 /sway/commands/move.c
parent667b8dcb67d8c3f15b52f59d228bb3146a5cdb30 (diff)
commands: fix workspace edge cases
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;