From 719119137746f4bd68837439e2ac3d0ea2c29246 Mon Sep 17 00:00:00 2001 From: Keith Bowes Date: Thu, 20 Feb 2020 09:04:56 -0500 Subject: [PATCH] Let setting the keyboard layout through the XKB_DEFAULT_* environment variables --- waybox/seat.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/waybox/seat.c b/waybox/seat.c index 7655db0..1928fb2 100644 --- a/waybox/seat.c +++ b/waybox/seat.c @@ -99,9 +99,14 @@ static void server_new_keyboard(struct wb_server *server, keyboard->server = server; keyboard->device = device; - /* We need to prepare an XKB keymap and assign it to the keyboard. This - * assumes the defaults (e.g. layout = "us"). */ - struct xkb_rule_names rules = { 0 }; + /* We need to prepare an XKB keymap and assign it to the keyboard. */ + struct xkb_rule_names rules = { + .rules = getenv("XKB_DEFAULT_RULES"), + .model = getenv("XKB_DEFAULT_MODEL"), + .layout = getenv("XKB_DEFAULT_LAYOUT"), + .variant = getenv("XKB_DEFAULT_VARIANT"), + .options = getenv("XKB_DEFAULT_OPTIONS"), + }; struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);