diff options
author | progandy <code@progandy> | 2015-12-17 22:28:41 +0100 |
---|---|---|
committer | progandy <code@progandy> | 2015-12-18 01:21:31 +0100 |
commit | 8f1ac1ef2c77665e7c17eaa6a46ea1b6d68e5c22 (patch) | |
tree | 83806713b8d0f1c562b70ca2f2a87bde30095191 /sway/commands.c | |
parent | 89341c0c702573065676eb5cf1ac2fcc6091eacf (diff) |
sway: enable workspace selection by number
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 15 |
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) { } const char *ws_name = argv[3]; - if (argc == 5) { + swayc_t *ws; + if (argc == 5 && strcasecmp(ws_name, "number") == 0) { // move "container to workspace number x" ws_name = argv[4]; + ws = workspace_by_number(ws_name); + } else { + ws = workspace_by_name(ws_name); } - swayc_t *ws = workspace_by_name(ws_name); if (ws == NULL) { ws = workspace_create(ws_name); } @@ -1435,13 +1438,17 @@ static struct cmd_results *cmd_workspace(int argc, char **argv) { if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1))) { return error; } - if (argc == 1) { + if (argc == 1 || (argc == 2 && strcasecmp(argv[0], "number") == 0) ) { if (config->reading || !config->active) { return cmd_results_new(CMD_DEFER, "workspace", NULL); } // Handle workspace next/prev swayc_t *ws = NULL; - if (strcasecmp(argv[0], "next") == 0) { + if (argc == 2) { + if (!(ws=workspace_by_number(argv[1]))) { + ws = workspace_create(argv[1]); + } + }else if (strcasecmp(argv[0], "next") == 0) { ws = workspace_next(); } else if (strcasecmp(argv[0], "prev") == 0) { ws = workspace_prev(); |