mirror of
https://github.com/swaywm/sway.git
synced 2024-11-29 03:11:27 +00:00
bindsym: change default keymap for --to-code
Replace XKB_DEFAULT_LAYOUT with NULL as the default layout.
This commit is contained in:
parent
f1609abe4c
commit
998de8fbc5
|
@ -43,24 +43,17 @@ static struct cmd_handler input_config_handlers[] = {
|
||||||
* Re-translate keysyms if a change in the input config could affect them.
|
* Re-translate keysyms if a change in the input config could affect them.
|
||||||
*/
|
*/
|
||||||
static void retranslate_keysyms(struct input_config *input_config) {
|
static void retranslate_keysyms(struct input_config *input_config) {
|
||||||
bool matched = false;
|
|
||||||
for (int i = 0; i < config->input_configs->length; ++i) {
|
for (int i = 0; i < config->input_configs->length; ++i) {
|
||||||
struct input_config *ic = config->input_configs->items[i];
|
struct input_config *ic = config->input_configs->items[i];
|
||||||
matched |= ic->identifier == input_config->identifier;
|
|
||||||
|
|
||||||
// the first configured xkb_layout
|
|
||||||
if (ic->xkb_layout) {
|
if (ic->xkb_layout) {
|
||||||
if (matched) {
|
// this is the first config with xkb_layout
|
||||||
|
if (ic->identifier == input_config->identifier) {
|
||||||
translate_keysyms(ic->xkb_layout);
|
translate_keysyms(ic->xkb_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// nothing has changed
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no xkb_layout has been set, restore the default
|
|
||||||
translate_keysyms(getenv("XKB_DEFAULT_LAYOUT"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cmd_results *cmd_input(int argc, char **argv) {
|
struct cmd_results *cmd_input(int argc, char **argv) {
|
||||||
|
|
|
@ -340,7 +340,7 @@ static void config_defaults(struct sway_config *config) {
|
||||||
|
|
||||||
// The keysym to keycode translation
|
// The keysym to keycode translation
|
||||||
config->keysym_translation_state =
|
config->keysym_translation_state =
|
||||||
keysym_translation_state_create(getenv("XKB_DEFAULT_LAYOUT"));
|
keysym_translation_state_create(NULL);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
Loading…
Reference in a new issue