diff options
Diffstat (limited to 'sway/commands/seat/attach.c')
-rw-r--r-- | sway/commands/seat/attach.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sway/commands/seat/attach.c b/sway/commands/seat/attach.c new file mode 100644 index 00000000..3e771c00 --- /dev/null +++ b/sway/commands/seat/attach.c | |||
@@ -0,0 +1,28 @@ | |||
1 | #define _XOPEN_SOURCE 700 | ||
2 | #include <string.h> | ||
3 | #include <strings.h> | ||
4 | #include "sway/input/input-manager.h" | ||
5 | #include "sway/commands.h" | ||
6 | #include "sway/config.h" | ||
7 | #include "log.h" | ||
8 | #include "stringop.h" | ||
9 | |||
10 | struct cmd_results *seat_cmd_attach(int argc, char **argv) { | ||
11 | struct cmd_results *error = NULL; | ||
12 | if ((error = checkarg(argc, "attach", EXPECTED_AT_LEAST, 1))) { | ||
13 | return error; | ||
14 | } | ||
15 | struct seat_config *current_seat_config = | ||
16 | config->handler_context.seat_config; | ||
17 | if (!current_seat_config) { | ||
18 | return cmd_results_new(CMD_FAILURE, "attach", "No seat defined"); | ||
19 | } | ||
20 | |||
21 | struct seat_config *new_config = new_seat_config(current_seat_config->name); | ||
22 | struct seat_attachment_config *new_attachment = seat_attachment_config_new(); | ||
23 | new_attachment->identifier = strdup(argv[0]); | ||
24 | list_add(new_config->attachments, new_attachment); | ||
25 | |||
26 | apply_seat_config(new_config); | ||
27 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
28 | } | ||