summaryrefslogtreecommitdiffstats
path: root/sway/commands/seat
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/seat')
-rw-r--r--sway/commands/seat/fallback.c29
1 files changed, 29 insertions, 0 deletions
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
7struct 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}