diff options
author | emersion <contact@emersion.fr> | 2017-10-26 19:59:32 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-10-26 19:59:32 +0200 |
commit | 4e5d23daa9b4d70bf8b614d5375ee1ccdab6771f (patch) | |
tree | 35e9f9862ad8d47c457cf1964612594854ea6dab /rootston/keyboard.c | |
parent | 92b41bb51ff1de631767f414a6595585ae1138a9 (diff) |
Per-keyboard configuration
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"); |