diff options
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/seat.c | 2 | ||||
-rw-r--r-- | sway/commands/seat/fallback.c | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sway/commands/seat.c b/sway/commands/seat.c index 4f9e259b..0149762a 100644 --- a/sway/commands/seat.c +++ b/sway/commands/seat.c | |||
@@ -24,6 +24,8 @@ struct cmd_results *cmd_seat(int argc, char **argv) { | |||
24 | current_seat_config = new_seat_config(argv[0]); | 24 | current_seat_config = new_seat_config(argv[0]); |
25 | if (strcasecmp("attach", argv[1]) == 0) { | 25 | if (strcasecmp("attach", argv[1]) == 0) { |
26 | res = seat_cmd_attach(argc_new, argv_new); | 26 | res = seat_cmd_attach(argc_new, argv_new); |
27 | } else if (strcasecmp("fallback", argv[1]) == 0) { | ||
28 | res = seat_cmd_fallback(argc_new, argv_new); | ||
27 | } else { | 29 | } else { |
28 | res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); | 30 | res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); |
29 | } | 31 | } |
diff --git a/sway/commands/seat/fallback.c b/sway/commands/seat/fallback.c new file mode 100644 index 00000000..7c129aae --- /dev/null +++ b/sway/commands/seat/fallback.c | |||
@@ -0,0 +1,29 @@ | |||
1 | #include <string.h> | ||
2 | #include <strings.h> | ||
3 | #include "sway/config.h" | ||
4 | #include "sway/commands.h" | ||
5 | #include "sway/input/input-manager.h" | ||
6 | |||
7 | struct cmd_results *seat_cmd_fallback(int argc, char **argv) { | ||
8 | struct cmd_results *error = NULL; | ||
9 | if ((error = checkarg(argc, "fallback", EXPECTED_AT_LEAST, 1))) { | ||
10 | return error; | ||
11 | } | ||
12 | if (!current_seat_config) { | ||
13 | return cmd_results_new(CMD_FAILURE, "fallback", "No seat defined"); | ||
14 | } | ||
15 | struct seat_config *new_config = | ||
16 | new_seat_config(current_seat_config->name); | ||
17 | |||
18 | if (strcasecmp(argv[0], "true") == 0) { | ||
19 | new_config->fallback = 1; | ||
20 | } else if (strcasecmp(argv[0], "false") == 0) { | ||
21 | new_config->fallback = 0; | ||
22 | } else { | ||
23 | return cmd_results_new(CMD_INVALID, "fallback", | ||
24 | "Expected 'fallback <true|false>'"); | ||
25 | } | ||
26 | |||
27 | apply_seat_config(new_config); | ||
28 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
29 | } | ||