diff options
Diffstat (limited to 'sway/commands/workspace.c')
-rw-r--r-- | sway/commands/workspace.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 5d4d3d65..35224f8a 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -5,21 +5,23 @@ | |||
5 | #include "sway/workspace.h" | 5 | #include "sway/workspace.h" |
6 | #include "list.h" | 6 | #include "list.h" |
7 | #include "log.h" | 7 | #include "log.h" |
8 | #include "stringop.h" | ||
8 | 9 | ||
9 | struct cmd_results *cmd_workspace(int argc, char **argv) { | 10 | struct cmd_results *cmd_workspace(int argc, char **argv) { |
10 | struct cmd_results *error = NULL; | 11 | struct cmd_results *error = NULL; |
11 | if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1))) { | 12 | if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1))) { |
12 | return error; | 13 | return error; |
13 | } | 14 | } |
14 | if (argc == 1 || (argc == 2 && strcasecmp(argv[0], "number") == 0) ) { | 15 | if (argc == 1 || (argc >= 2 && strcasecmp(argv[0], "number") == 0) ) { |
15 | if (config->reading || !config->active) { | 16 | if (config->reading || !config->active) { |
16 | return cmd_results_new(CMD_DEFER, "workspace", NULL); | 17 | return cmd_results_new(CMD_DEFER, "workspace", NULL); |
17 | } | 18 | } |
18 | // Handle workspace next/prev | ||
19 | swayc_t *ws = NULL; | 19 | swayc_t *ws = NULL; |
20 | if (argc == 2) { | 20 | if (argc >= 2) { |
21 | if (!(ws = workspace_by_number(argv[1]))) { | 21 | if (!(ws = workspace_by_number(argv[1]))) { |
22 | ws = workspace_create(argv[1]); | 22 | char *name = join_args(argv + 1, argc - 1); |
23 | ws = workspace_create(name); | ||
24 | free(name); | ||
23 | } | 25 | } |
24 | } else if (strcasecmp(argv[0], "next") == 0) { | 26 | } else if (strcasecmp(argv[0], "next") == 0) { |
25 | ws = workspace_next(); | 27 | ws = workspace_next(); |