summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c
index b40cdb6a..24d56052 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -649,12 +649,15 @@ static struct cmd_results *cmd_move(int argc, char **argv) {
649 } 649 }
650 650
651 const char *ws_name = argv[3]; 651 const char *ws_name = argv[3];
652 if (argc == 5) { 652 swayc_t *ws;
653 if (argc == 5 && strcasecmp(ws_name, "number") == 0) {
653 // move "container to workspace number x" 654 // move "container to workspace number x"
654 ws_name = argv[4]; 655 ws_name = argv[4];
656 ws = workspace_by_number(ws_name);
657 } else {
658 ws = workspace_by_name(ws_name);
655 } 659 }
656 660
657 swayc_t *ws = workspace_by_name(ws_name);
658 if (ws == NULL) { 661 if (ws == NULL) {
659 ws = workspace_create(ws_name); 662 ws = workspace_create(ws_name);
660 } 663 }
@@ -1435,13 +1438,17 @@ static struct cmd_results *cmd_workspace(int argc, char **argv) {
1435 if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1))) { 1438 if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1))) {
1436 return error; 1439 return error;
1437 } 1440 }
1438 if (argc == 1) { 1441 if (argc == 1 || (argc == 2 && strcasecmp(argv[0], "number") == 0) ) {
1439 if (config->reading || !config->active) { 1442 if (config->reading || !config->active) {
1440 return cmd_results_new(CMD_DEFER, "workspace", NULL); 1443 return cmd_results_new(CMD_DEFER, "workspace", NULL);
1441 } 1444 }
1442 // Handle workspace next/prev 1445 // Handle workspace next/prev
1443 swayc_t *ws = NULL; 1446 swayc_t *ws = NULL;
1444 if (strcasecmp(argv[0], "next") == 0) { 1447 if (argc == 2) {
1448 if (!(ws=workspace_by_number(argv[1]))) {
1449 ws = workspace_create(argv[1]);
1450 }
1451 }else if (strcasecmp(argv[0], "next") == 0) {
1445 ws = workspace_next(); 1452 ws = workspace_next();
1446 } else if (strcasecmp(argv[0], "prev") == 0) { 1453 } else if (strcasecmp(argv[0], "prev") == 0) {
1447 ws = workspace_prev(); 1454 ws = workspace_prev();