diff options
Diffstat (limited to 'sway/commands/workspace.c')
-rw-r--r-- | sway/commands/workspace.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 168494d2..92118ecf 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -21,6 +21,7 @@ static struct workspace_config *workspace_config_find_or_create(char *ws_name) { | |||
21 | return NULL; | 21 | return NULL; |
22 | } | 22 | } |
23 | wsc->workspace = strdup(ws_name); | 23 | wsc->workspace = strdup(ws_name); |
24 | wsc->outputs = create_list(); | ||
24 | wsc->gaps_inner = INT_MIN; | 25 | wsc->gaps_inner = INT_MIN; |
25 | wsc->gaps_outer.top = INT_MIN; | 26 | wsc->gaps_outer.top = INT_MIN; |
26 | wsc->gaps_outer.right = INT_MIN; | 27 | wsc->gaps_outer.right = INT_MIN; |
@@ -32,7 +33,7 @@ static struct workspace_config *workspace_config_find_or_create(char *ws_name) { | |||
32 | 33 | ||
33 | void free_workspace_config(struct workspace_config *wsc) { | 34 | void free_workspace_config(struct workspace_config *wsc) { |
34 | free(wsc->workspace); | 35 | free(wsc->workspace); |
35 | free(wsc->output); | 36 | free_flat_list(wsc->outputs); |
36 | free(wsc); | 37 | free(wsc); |
37 | } | 38 | } |
38 | 39 | ||
@@ -141,18 +142,20 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
141 | } | 142 | } |
142 | } | 143 | } |
143 | if (output_location >= 0) { | 144 | if (output_location >= 0) { |
144 | if ((error = checkarg(argc, "workspace", EXPECTED_EQUAL_TO, output_location + 2))) { | 145 | if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST, |
146 | output_location + 2))) { | ||
145 | return error; | 147 | return error; |
146 | } | 148 | } |
147 | char *ws_name = join_args(argv, argc - 2); | 149 | char *ws_name = join_args(argv, output_location); |
148 | struct workspace_config *wsc = workspace_config_find_or_create(ws_name); | 150 | struct workspace_config *wsc = workspace_config_find_or_create(ws_name); |
149 | free(ws_name); | 151 | free(ws_name); |
150 | if (!wsc) { | 152 | if (!wsc) { |
151 | return cmd_results_new(CMD_FAILURE, "workspace output", | 153 | return cmd_results_new(CMD_FAILURE, "workspace output", |
152 | "Unable to allocate workspace output"); | 154 | "Unable to allocate workspace output"); |
153 | } | 155 | } |
154 | free(wsc->output); | 156 | for (int i = output_location + 1; i < argc; ++i) { |
155 | wsc->output = strdup(argv[output_location + 1]); | 157 | list_add(wsc->outputs, strdup(argv[i])); |
158 | } | ||
156 | } else if (gaps_location >= 0) { | 159 | } else if (gaps_location >= 0) { |
157 | if ((error = cmd_workspace_gaps(argc, argv, gaps_location))) { | 160 | if ((error = cmd_workspace_gaps(argc, argv, gaps_location))) { |
158 | return error; | 161 | return error; |