river: add keyboard-layout command

This allows switching river's keyboard layout at runtime.
This commit is contained in:
Leon Henrik Plickat
2022-10-16 21:49:40 +02:00
committed by Isaac Freund
parent 2eb0a7a75c
commit ad1dbb1180
5 changed files with 109 additions and 1 deletions
+2 -1
View File
@@ -51,7 +51,8 @@ pub fn init(self: *Self, seat: *Seat, wlr_device: *wlr.InputDevice) !void {
// Passing null here indicates that defaults from libxkbcommon and
// its XKB_DEFAULT_LAYOUT, XKB_DEFAULT_OPTIONS, etc. should be used.
const keymap = xkb.Keymap.newFromNames(context, null, .no_flags) orelse return error.XkbKeymapFailed;
const layout_config = if (server.config.keyboard_layout) |kl| &kl else null;
const keymap = xkb.Keymap.newFromNames(context, layout_config, .no_flags) orelse return error.XkbKeymapFailed;
defer keymap.unref();
const wlr_keyboard = self.device.wlr_device.toKeyboard();