summaryrefslogtreecommitdiff
path: root/sway/commands/input.c
diff options
context:
space:
mode:
authorSimon Ser <[email protected]>2019-06-09 21:17:28 +0300
committerDrew DeVault <[email protected]>2019-06-09 15:20:14 -0400
commit2bccb387d81298ffd3b88a193deb3e32c0b6c494 (patch)
treeeda04f72b85e4b3251fc18336b925c67a9678b7c /sway/commands/input.c
parent84e4061bf40ab8749fb467e5662ea495d98036ab (diff)
Add a new xkb_switch_layout command
This allows users to programatically change the active layout.
Diffstat (limited to 'sway/commands/input.c')
-rw-r--r--sway/commands/input.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c
index d95c4baf..08af3cb2 100644
--- a/sway/commands/input.c
+++ b/sway/commands/input.c
@@ -31,6 +31,7 @@ static struct cmd_handler input_handlers[] = {
{ "xkb_model", input_cmd_xkb_model },
{ "xkb_options", input_cmd_xkb_options },
{ "xkb_rules", input_cmd_xkb_rules },
+ { "xkb_switch_layout", input_cmd_xkb_switch_layout },
{ "xkb_variant", input_cmd_xkb_variant },
};
@@ -86,7 +87,8 @@ struct cmd_results *cmd_input(int argc, char **argv) {
input_handlers, sizeof(input_handlers));
}
- if (!res || res->status == CMD_SUCCESS) {
+ if ((!res || res->status == CMD_SUCCESS) &&
+ strcmp(argv[1], "xkb_switch_layout") != 0) {
char *error = NULL;
struct input_config *ic =
store_input_config(config->handler_context.input_config, &error);