Keyboard layout per keyboard on kwin/wayland?

Hello,

Is there any way in kwin/wayland to set keyboard layout per keyboard?
It’s the last pain point to be able to switch from X11 to wayland.

I’m using BÉPO for everyday keyboard, but also have a Yubikey which doesn’t work on BÉPO but only on QWERTY.
Currently on X11, I can just map each keyboard with there own layout

/etc/X11/xorg.conf.d/00-keyboard.conf

Section "InputClass"
  Identifier          "moonlander"
  MatchIsKeyboard     "yes"
  MatchVendor         "ZSA"
  Option "XkbModel"   "pc105"
  Option "XkbLayout"  "fr"
  Option "XkbVariant" "bepo"
EndSection

Section "InputClass"
  Identifier          "yubikey"
  MatchIsKeyboard     "yes"
  MatchVendor         "Yubico"
  Option "XkbModel"   "pc105"
  Option "XkbLayout"  "us"
  Option "XkbVariant" "basic"
EndSection

Has kwin/wayland any way to support such config per keyboard?
At the moment I can’t drop X11 just because this lack of feature.

I have been using bépo in kwin/Wayland for years.
You just set the keyboard layout in the keyboard settings, it will be a layout for French:

And I use a smart-card too, no configuration needed.

Trouble is not setting one layout for every keyboard, but to have one layout per keyboard.
Layout must be BÉPO by default, but at least one keyboard (my Yubikey) must stay in QWERTY.
X11 can handle that, but seems Kwin/wayland not at this time.

KWin uses xkb to setup keyboard (and layouts). It does not seem possible to have two layouts at the same time.

https://unix.stackexchange.com/questions/309580/does-wayland-use-xkb-for-keyboard-layouts gives some hints.

It is at least easy enough to switch from one layout to another with the systray keyboard applet, but that’s less than convenient.

1 Like