diff options
-rw-r--r-- | sway/commands.c | 1 | ||||
-rw-r--r-- | sway/commands/workspace_layout.c | 21 | ||||
-rw-r--r-- | sway/meson.build | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index b55ea58c..6f5113f8 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -169,6 +169,7 @@ static struct cmd_handler config_handlers[] = { | |||
169 | { "default_orientation", cmd_default_orientation }, | 169 | { "default_orientation", cmd_default_orientation }, |
170 | { "set", cmd_set }, | 170 | { "set", cmd_set }, |
171 | { "swaybg_command", cmd_swaybg_command }, | 171 | { "swaybg_command", cmd_swaybg_command }, |
172 | { "workspace_layout", cmd_workspace_layout }, | ||
172 | }; | 173 | }; |
173 | 174 | ||
174 | /* Runtime-only commands. Keep alphabetized */ | 175 | /* Runtime-only commands. Keep alphabetized */ |
diff --git a/sway/commands/workspace_layout.c b/sway/commands/workspace_layout.c new file mode 100644 index 00000000..ed4c0ee0 --- /dev/null +++ b/sway/commands/workspace_layout.c | |||
@@ -0,0 +1,21 @@ | |||
1 | #include <string.h> | ||
2 | #include <strings.h> | ||
3 | #include "sway/commands.h" | ||
4 | |||
5 | struct cmd_results *cmd_workspace_layout(int argc, char **argv) { | ||
6 | struct cmd_results *error = NULL; | ||
7 | if ((error = checkarg(argc, "workspace_layout", EXPECTED_EQUAL_TO, 1))) { | ||
8 | return error; | ||
9 | } | ||
10 | if (strcasecmp(argv[0], "default") == 0) { | ||
11 | config->default_layout = L_NONE; | ||
12 | } else if (strcasecmp(argv[0], "stacking") == 0) { | ||
13 | config->default_layout = L_STACKED; | ||
14 | } else if (strcasecmp(argv[0], "tabbed") == 0) { | ||
15 | config->default_layout = L_TABBED; | ||
16 | } else { | ||
17 | return cmd_results_new(CMD_INVALID, "workspace_layout", | ||
18 | "Expected 'workspace_layout <default|stacking|tabbed>'"); | ||
19 | } | ||
20 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
21 | } | ||
diff --git a/sway/meson.build b/sway/meson.build index e5878b9e..68675f67 100644 --- a/sway/meson.build +++ b/sway/meson.build | |||
@@ -69,6 +69,7 @@ sway_sources = files( | |||
69 | 'commands/title_format.c', | 69 | 'commands/title_format.c', |
70 | 'commands/unmark.c', | 70 | 'commands/unmark.c', |
71 | 'commands/workspace.c', | 71 | 'commands/workspace.c', |
72 | 'commands/workspace_layout.c', | ||
72 | 'commands/ws_auto_back_and_forth.c', | 73 | 'commands/ws_auto_back_and_forth.c', |
73 | 74 | ||
74 | 'commands/bar/activate_button.c', | 75 | 'commands/bar/activate_button.c', |