As XKB is part of X window, is it XKB used in Wayland as well? If so, is there any utility planed to replace XKB at some point?
In weston, setxkbmap does not work obviously. What is the currently recommended way to change keyboard layout?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Yes, Wayland uses XKB for keyboard layouts. But it's not quite the right question, because things work different than in X. Remember that Wayland is only a protocol (plus a wrapper library).
At the protocol level, wayland has a wl_keyboard.keymap event. This event contains a file descriptor to the keymap and a format classifier. Right now, only one format is defined: "xkb". So a wayland client will receive an XKB-compatible keymap and can use libxkbcommon to interpret that to get the right glyph on the screen, etc.
But Wayland does not define how this keymap is decided on. This decision is up to the compositor. In Weston, it is read from the config file on startup, in GNOME it comes from gsettings, etc. And this decision thus also defines how you can change keymaps at runtime (if at all possible). In GNOME you'd either use the config panel or you'd set the gsettings keys directly.
The X protocol has requests to set the keymap on the protocol level and these are what makes tools like setxkbmap possible. The Wayland does not have these requests, it's not possible to set the keymap using the Wayland protocol alone.