aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Konstantin Pospelov <kupospelov@gmail.com>2019-02-19 21:17:07 +0300
committerLibravatar Simon Ser <contact@emersion.fr>2019-04-26 20:56:48 +0300
commit998de8fbc5b4115f1fba9853f85484a5a2ec0c84 (patch)
treee46f48d5d2ddcce650e9adf8b386bf64ddafd08a
parentconfig: simplify keysym translation fields (diff)
downloadsway-998de8fbc5b4115f1fba9853f85484a5a2ec0c84.tar.gz
sway-998de8fbc5b4115f1fba9853f85484a5a2ec0c84.tar.zst
sway-998de8fbc5b4115f1fba9853f85484a5a2ec0c84.zip
bindsym: change default keymap for --to-code
Replace XKB_DEFAULT_LAYOUT with NULL as the default layout.
-rw-r--r--sway/commands/input.c11
-rw-r--r--sway/config.c2
2 files changed, 3 insertions, 10 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c
index 903d574f..2de07de6 100644
--- a/sway/commands/input.c
+++ b/sway/commands/input.c
@@ -43,24 +43,17 @@ static struct cmd_handler input_config_handlers[] = {
43 * Re-translate keysyms if a change in the input config could affect them. 43 * Re-translate keysyms if a change in the input config could affect them.
44 */ 44 */
45static void retranslate_keysyms(struct input_config *input_config) { 45static void retranslate_keysyms(struct input_config *input_config) {
46 bool matched = false;
47 for (int i = 0; i < config->input_configs->length; ++i) { 46 for (int i = 0; i < config->input_configs->length; ++i) {
48 struct input_config *ic = config->input_configs->items[i]; 47 struct input_config *ic = config->input_configs->items[i];
49 matched |= ic->identifier == input_config->identifier;
50
51 // the first configured xkb_layout
52 if (ic->xkb_layout) { 48 if (ic->xkb_layout) {
53 if (matched) { 49 // this is the first config with xkb_layout
50 if (ic->identifier == input_config->identifier) {
54 translate_keysyms(ic->xkb_layout); 51 translate_keysyms(ic->xkb_layout);
55 } 52 }
56 53
57 // nothing has changed
58 return; 54 return;
59 } 55 }
60 } 56 }
61
62 // no xkb_layout has been set, restore the default
63 translate_keysyms(getenv("XKB_DEFAULT_LAYOUT"));
64} 57}
65 58
66struct cmd_results *cmd_input(int argc, char **argv) { 59struct cmd_results *cmd_input(int argc, char **argv) {
diff --git a/sway/config.c b/sway/config.c
index c5d892f3..8579e865 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -340,7 +340,7 @@ static void config_defaults(struct sway_config *config) {
340 340
341 // The keysym to keycode translation 341 // The keysym to keycode translation
342 config->keysym_translation_state = 342 config->keysym_translation_state =
343 keysym_translation_state_create(getenv("XKB_DEFAULT_LAYOUT")); 343 keysym_translation_state_create(NULL);
344 344
345 return; 345 return;
346cleanup: 346cleanup: