mirror of
https://github.com/swaywm/sway.git
synced 2025-11-08 13:29:50 -05:00
seat fallback config
This commit is contained in:
parent
e27eff8a29
commit
88bcd43ebf
9 changed files with 105 additions and 31 deletions
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
29
sway/commands/seat/fallback.c
Normal file
29
sway/commands/seat/fallback.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue