diff options
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/seat.c | 2 | ||||
-rw-r--r-- | sway/commands/seat/fallback.c | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sway/commands/seat.c b/sway/commands/seat.c index 4f9e259b..0149762a 100644 --- a/sway/commands/seat.c +++ b/sway/commands/seat.c @@ -24,6 +24,8 @@ struct cmd_results *cmd_seat(int argc, char **argv) { current_seat_config = new_seat_config(argv[0]); if (strcasecmp("attach", argv[1]) == 0) { res = seat_cmd_attach(argc_new, argv_new); + } else if (strcasecmp("fallback", argv[1]) == 0) { + res = seat_cmd_fallback(argc_new, argv_new); } else { res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); } 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 @@ +#include <string.h> +#include <strings.h> +#include "sway/config.h" +#include "sway/commands.h" +#include "sway/input/input-manager.h" + +struct cmd_results *seat_cmd_fallback(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "fallback", EXPECTED_AT_LEAST, 1))) { + return error; + } + if (!current_seat_config) { + return cmd_results_new(CMD_FAILURE, "fallback", "No seat defined"); + } + struct seat_config *new_config = + new_seat_config(current_seat_config->name); + + if (strcasecmp(argv[0], "true") == 0) { + new_config->fallback = 1; + } else if (strcasecmp(argv[0], "false") == 0) { + new_config->fallback = 0; + } else { + return cmd_results_new(CMD_INVALID, "fallback", + "Expected 'fallback <true|false>'"); + } + + apply_seat_config(new_config); + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} |