summaryrefslogtreecommitdiffstats
path: root/sway/commands/seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/seat.c')
-rw-r--r--sway/commands/seat.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/sway/commands/seat.c b/sway/commands/seat.c
new file mode 100644
index 00000000..155bc510
--- /dev/null
+++ b/sway/commands/seat.c
@@ -0,0 +1,37 @@
1#include <string.h>
2#include <strings.h>
3#include "sway/commands.h"
4#include "sway/input/input-manager.h"
5#include "log.h"
6
7struct cmd_results *cmd_seat(int argc, char **argv) {
8 struct cmd_results *error = NULL;
9 if ((error = checkarg(argc, "seat", EXPECTED_AT_LEAST, 2))) {
10 return error;
11 }
12
13 if (config->reading && strcmp("{", argv[1]) == 0) {
14 current_seat_config = new_seat_config(argv[0]);
15 sway_log(L_DEBUG, "entering seat block: %s", current_seat_config->name);
16 return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
17 }
18
19 if ((error = checkarg(argc, "seat", EXPECTED_AT_LEAST, 3))) {
20 return error;
21 }
22
23 int argc_new = argc-2;
24 char **argv_new = argv+2;
25
26 struct cmd_results *res;
27 current_seat_config = new_seat_config(argv[0]);
28 if (strcasecmp("attach", argv[1]) == 0) {
29 res = seat_cmd_attach(argc_new, argv_new);
30 } else if (strcasecmp("fallback", argv[1]) == 0) {
31 res = seat_cmd_fallback(argc_new, argv_new);
32 } else {
33 res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]);
34 }
35 current_seat_config = NULL;
36 return res;
37}