aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/workspace.c13
-rw-r--r--sway/commands/ws_auto_back_and_forth.c2
2 files changed, 9 insertions, 6 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) {
return NULL;
}
wsc->workspace = strdup(ws_name);
+ wsc->outputs = create_list();
wsc->gaps_inner = INT_MIN;
wsc->gaps_outer.top = INT_MIN;
wsc->gaps_outer.right = INT_MIN;
@@ -32,7 +33,7 @@ static struct workspace_config *workspace_config_find_or_create(char *ws_name) {
void free_workspace_config(struct workspace_config *wsc) {
free(wsc->workspace);
- free(wsc->output);
+ free_flat_list(wsc->outputs);
free(wsc);
}
@@ -141,18 +142,20 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
}
}
if (output_location >= 0) {
- if ((error = checkarg(argc, "workspace", EXPECTED_EQUAL_TO, output_location + 2))) {
+ if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST,
+ output_location + 2))) {
return error;
}
- char *ws_name = join_args(argv, argc - 2);
+ char *ws_name = join_args(argv, output_location);
struct workspace_config *wsc = workspace_config_find_or_create(ws_name);
free(ws_name);
if (!wsc) {
return cmd_results_new(CMD_FAILURE, "workspace output",
"Unable to allocate workspace output");
}
- free(wsc->output);
- wsc->output = strdup(argv[output_location + 1]);
+ for (int i = output_location + 1; i < argc; ++i) {
+ list_add(wsc->outputs, strdup(argv[i]));
+ }
} else if (gaps_location >= 0) {
if ((error = cmd_workspace_gaps(argc, argv, gaps_location))) {
return error;
diff --git a/sway/commands/ws_auto_back_and_forth.c b/sway/commands/ws_auto_back_and_forth.c
index 3449d4cc..adb851c2 100644
--- a/sway/commands/ws_auto_back_and_forth.c
+++ b/sway/commands/ws_auto_back_and_forth.c
@@ -9,6 +9,6 @@ struct cmd_results *cmd_ws_auto_back_and_forth(int argc, char **argv) {
return error;
}
config->auto_back_and_forth =
- !parse_boolean(argv[0], config->auto_back_and_forth);
+ parse_boolean(argv[0], config->auto_back_and_forth);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}