summaryrefslogtreecommitdiffstats
path: root/sway/commands/seat/fallback.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/seat/fallback.c')
-rw-r--r--sway/commands/seat/fallback.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sway/commands/seat/fallback.c b/sway/commands/seat/fallback.c
new file mode 100644
index 00000000..56feaab5
--- /dev/null
+++ b/sway/commands/seat/fallback.c
@@ -0,0 +1,32 @@
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 struct seat_config *current_seat_config =
13 config->handler_context.seat_config;
14 if (!current_seat_config) {
15 return cmd_results_new(CMD_FAILURE, "fallback", "No seat defined");
16 }
17 struct seat_config *new_config =
18 new_seat_config(current_seat_config->name);
19
20 if (strcasecmp(argv[0], "true") == 0) {
21 new_config->fallback = 1;
22 } else if (strcasecmp(argv[0], "false") == 0) {
23 new_config->fallback = 0;
24 } else {
25 free_seat_config(new_config);
26 return cmd_results_new(CMD_INVALID, "fallback",
27 "Expected 'fallback <true|false>'");
28 }
29
30 apply_seat_config(new_config);
31 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
32}