diff options
-rw-r--r-- | sway/commands/input.c | 23 | ||||
-rw-r--r-- | sway/sway-input.5.scd | 8 |
2 files changed, 24 insertions, 7 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c index 7f927073..84888fbb 100644 --- a/sway/commands/input.c +++ b/sway/commands/input.c | |||
@@ -24,15 +24,19 @@ static struct cmd_handler input_handlers[] = { | |||
24 | { "scroll_method", input_cmd_scroll_method }, | 24 | { "scroll_method", input_cmd_scroll_method }, |
25 | { "tap", input_cmd_tap }, | 25 | { "tap", input_cmd_tap }, |
26 | { "tap_button_map", input_cmd_tap_button_map }, | 26 | { "tap_button_map", input_cmd_tap_button_map }, |
27 | { "xkb_capslock", input_cmd_xkb_capslock }, | ||
28 | { "xkb_layout", input_cmd_xkb_layout }, | 27 | { "xkb_layout", input_cmd_xkb_layout }, |
29 | { "xkb_model", input_cmd_xkb_model }, | 28 | { "xkb_model", input_cmd_xkb_model }, |
30 | { "xkb_numlock", input_cmd_xkb_numlock }, | ||
31 | { "xkb_options", input_cmd_xkb_options }, | 29 | { "xkb_options", input_cmd_xkb_options }, |
32 | { "xkb_rules", input_cmd_xkb_rules }, | 30 | { "xkb_rules", input_cmd_xkb_rules }, |
33 | { "xkb_variant", input_cmd_xkb_variant }, | 31 | { "xkb_variant", input_cmd_xkb_variant }, |
34 | }; | 32 | }; |
35 | 33 | ||
34 | // must be in order for the bsearch | ||
35 | static struct cmd_handler input_config_handlers[] = { | ||
36 | { "xkb_capslock", input_cmd_xkb_capslock }, | ||
37 | { "xkb_numlock", input_cmd_xkb_numlock }, | ||
38 | }; | ||
39 | |||
36 | struct cmd_results *cmd_input(int argc, char **argv) { | 40 | struct cmd_results *cmd_input(int argc, char **argv) { |
37 | struct cmd_results *error = NULL; | 41 | struct cmd_results *error = NULL; |
38 | if ((error = checkarg(argc, "input", EXPECTED_AT_LEAST, 2))) { | 42 | if ((error = checkarg(argc, "input", EXPECTED_AT_LEAST, 2))) { |
@@ -46,8 +50,21 @@ struct cmd_results *cmd_input(int argc, char **argv) { | |||
46 | return cmd_results_new(CMD_FAILURE, NULL, "Couldn't allocate config"); | 50 | return cmd_results_new(CMD_FAILURE, NULL, "Couldn't allocate config"); |
47 | } | 51 | } |
48 | 52 | ||
49 | struct cmd_results *res = config_subcommand(argv + 1, argc - 1, | 53 | struct cmd_results *res; |
54 | |||
55 | if (find_handler(argv[1], input_config_handlers, | ||
56 | sizeof(input_config_handlers))) { | ||
57 | if (config->reading) { | ||
58 | res = config_subcommand(argv + 1, argc - 1, | ||
59 | input_config_handlers, sizeof(input_config_handlers)); | ||
60 | } else { | ||
61 | res = cmd_results_new(CMD_FAILURE, "input", | ||
62 | "Can only be used in config file."); | ||
63 | } | ||
64 | } else { | ||
65 | res = config_subcommand(argv + 1, argc - 1, | ||
50 | input_handlers, sizeof(input_handlers)); | 66 | input_handlers, sizeof(input_handlers)); |
67 | } | ||
51 | 68 | ||
52 | free_input_config(config->handler_context.input_config); | 69 | free_input_config(config->handler_context.input_config); |
53 | config->handler_context.input_config = NULL; | 70 | config->handler_context.input_config = NULL; |
diff --git a/sway/sway-input.5.scd b/sway/sway-input.5.scd index 372ca697..fa311971 100644 --- a/sway/sway-input.5.scd +++ b/sway/sway-input.5.scd | |||
@@ -33,13 +33,13 @@ For more information on these xkb configuration options, see | |||
33 | *input* <identifier> xkb\_variant <variant> | 33 | *input* <identifier> xkb\_variant <variant> |
34 | Sets the variant of the keyboard like _dvorak_ or _colemak_. | 34 | Sets the variant of the keyboard like _dvorak_ or _colemak_. |
35 | 35 | ||
36 | The following commands may only be used in the configuration file. | ||
37 | |||
36 | *input* <identifier> xkb\_capslock enabled|disabled | 38 | *input* <identifier> xkb\_capslock enabled|disabled |
37 | Enables or disables CapsLock on sway startup, the default is disabled. | 39 | Initially enables or disables CapsLock, the default is disabled. |
38 | Only meaningful if sway controls the keyboard. | ||
39 | 40 | ||
40 | *input* <identifier> xkb\_numlock enabled|disabled | 41 | *input* <identifier> xkb\_numlock enabled|disabled |
41 | Enables or disables NumLock on sway startup, the default is enabled. | 42 | Initially enables or disables NumLock, the default is enabled. |
42 | Only meaningful if sway controls the keyboard. | ||
43 | 43 | ||
44 | ## MAPPING CONFIGURATION | 44 | ## MAPPING CONFIGURATION |
45 | 45 | ||