diff options
Diffstat (limited to 'rootston/keyboard.c')
-rw-r--r-- | rootston/keyboard.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/rootston/keyboard.c b/rootston/keyboard.c index 61604da0..008fba2d 100644 --- a/rootston/keyboard.c +++ b/rootston/keyboard.c @@ -137,13 +137,33 @@ void keyboard_add(struct wlr_input_device *device, struct roots_input *input) { wl_signal_add(&device->keyboard->events.key, &keyboard->key); wl_list_insert(&input->keyboards, &keyboard->link); + struct keyboard_config *config = config_get_keyboard(input->config, + device); + struct xkb_rule_names rules; memset(&rules, 0, sizeof(rules)); - rules.rules = getenv("XKB_DEFAULT_RULES"); - rules.model = getenv("XKB_DEFAULT_MODEL"); - rules.layout = getenv("XKB_DEFAULT_LAYOUT"); - rules.variant = getenv("XKB_DEFAULT_VARIANT"); - rules.options = getenv("XKB_DEFAULT_OPTIONS"); + if (config != NULL) { + rules.rules = config->rules; + rules.model = config->model; + rules.layout = config->layout; + rules.variant = config->variant; + rules.options = config->options; + } + if (rules.rules == NULL) { + rules.rules = getenv("XKB_DEFAULT_RULES"); + } + if (rules.model == NULL) { + rules.model = getenv("XKB_DEFAULT_MODEL"); + } + if (rules.layout == NULL) { + rules.layout = getenv("XKB_DEFAULT_LAYOUT"); + } + if (rules.variant == NULL) { + rules.variant = getenv("XKB_DEFAULT_VARIANT"); + } + if (rules.options == NULL) { + rules.options = getenv("XKB_DEFAULT_OPTIONS"); + } struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); if (context == NULL) { wlr_log(L_ERROR, "Cannot create XKB context"); |