diff options
Diffstat (limited to 'sway/commands/seat/keyboard_grouping.c')
-rw-r--r-- | sway/commands/seat/keyboard_grouping.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/commands/seat/keyboard_grouping.c b/sway/commands/seat/keyboard_grouping.c new file mode 100644 index 00000000..959c6f94 --- /dev/null +++ b/sway/commands/seat/keyboard_grouping.c | |||
@@ -0,0 +1,26 @@ | |||
1 | #include <string.h> | ||
2 | #include "sway/commands.h" | ||
3 | #include "sway/config.h" | ||
4 | #include "stringop.h" | ||
5 | |||
6 | struct cmd_results *seat_cmd_keyboard_grouping(int argc, char **argv) { | ||
7 | struct cmd_results *error = NULL; | ||
8 | if ((error = checkarg(argc, "keyboard_grouping", EXPECTED_EQUAL_TO, 1))) { | ||
9 | return error; | ||
10 | } | ||
11 | if (!config->handler_context.seat_config) { | ||
12 | return cmd_results_new(CMD_INVALID, "No seat defined"); | ||
13 | } | ||
14 | |||
15 | struct seat_config *seat_config = config->handler_context.seat_config; | ||
16 | if (strcmp(argv[0], "none") == 0) { | ||
17 | seat_config->keyboard_grouping = KEYBOARD_GROUP_NONE; | ||
18 | } else if (strcmp(argv[0], "keymap") == 0) { | ||
19 | seat_config->keyboard_grouping = KEYBOARD_GROUP_KEYMAP; | ||
20 | } else { | ||
21 | return cmd_results_new(CMD_INVALID, | ||
22 | "Expected syntax `keyboard_grouping none|keymap`"); | ||
23 | } | ||
24 | |||
25 | return cmd_results_new(CMD_SUCCESS, NULL); | ||
26 | } | ||