aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 7f4fef09..43166a1c 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -556,7 +556,7 @@ static struct cmd_results *cmd_move(int argc, char **argv) {
556 } 556 }
557 const char* expected_syntax = "Expected 'move <left|right|up|down>' or " 557 const char* expected_syntax = "Expected 'move <left|right|up|down>' or "
558 "'move <container|window> to workspace <name>' or " 558 "'move <container|window> to workspace <name>' or "
559 "'move <container|window> to output <name|direction>'"; 559 "'move <container|window|workspace> to output <name|direction>'";
560 swayc_t *view = get_focused_container(&root_container); 560 swayc_t *view = get_focused_container(&root_container);
561 561
562 if (strcasecmp(argv[0], "left") == 0) { 562 if (strcasecmp(argv[0], "left") == 0) {
@@ -607,6 +607,25 @@ static struct cmd_results *cmd_move(int argc, char **argv) {
607 } else { 607 } else {
608 return cmd_results_new(CMD_INVALID, "move", expected_syntax); 608 return cmd_results_new(CMD_INVALID, "move", expected_syntax);
609 } 609 }
610 } else if (strcasecmp(argv[0], "workspace") == 0) {
611 // move workspace (to output x)
612 swayc_t *output = NULL;
613 if ((error = checkarg(argc, "move workspace", EXPECTED_EQUAL_TO, 4))) {
614 return error;
615 } else if (strcasecmp(argv[1], "to") != 0 || strcasecmp(argv[2], "output") != 0) {
616 return cmd_results_new(CMD_INVALID, "move", expected_syntax);
617 } else if (!(output = output_by_name(argv[3]))) {
618 return cmd_results_new(CMD_FAILURE, "move workspace",
619 "Can't find output with name/at direction '%s'", argv[3]);
620 }
621 if (view->type == C_WORKSPACE) {
622 // This probably means we're moving an empty workspace, but
623 // that's fine.
624 move_workspace_to(view, output);
625 } else {
626 swayc_t *workspace = swayc_parent_by_type(view, C_WORKSPACE);
627 move_workspace_to(workspace, output);
628 }
610 } else if (strcasecmp(argv[0], "scratchpad") == 0) { 629 } else if (strcasecmp(argv[0], "scratchpad") == 0) {
611 // move scratchpad ... 630 // move scratchpad ...
612 if (view->type != C_CONTAINER && view->type != C_VIEW) { 631 if (view->type != C_CONTAINER && view->type != C_VIEW) {