diff options
Diffstat (limited to 'sway/commands/seat/attach.c')
-rw-r--r-- | sway/commands/seat/attach.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/commands/seat/attach.c b/sway/commands/seat/attach.c new file mode 100644 index 00000000..80ec63ce --- /dev/null +++ b/sway/commands/seat/attach.c | |||
@@ -0,0 +1,26 @@ | |||
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 | if (!current_seat_config) { | ||
16 | return cmd_results_new(CMD_FAILURE, "attach", "No seat defined"); | ||
17 | } | ||
18 | |||
19 | struct seat_config *new_config = new_seat_config(current_seat_config->name); | ||
20 | struct seat_attachment_config *new_attachment = seat_attachment_config_new(); | ||
21 | new_attachment->identifier = strdup(argv[0]); | ||
22 | list_add(new_config->attachments, new_attachment); | ||
23 | |||
24 | apply_seat_config(new_config); | ||
25 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
26 | } | ||