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?

1 Answer 1


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.

  • 9
    Hi, could you please post and example on how to map keys on Gnome, or some reference material, I'm trying to change my right alt to enter. Feb 23, 2017 at 8:48
  • @alejandrodnm Did you try xremap?
    – Pablo A
    Sep 2, 2022 at 22:41
  • @PabloA, I just needed right alt to be enter. I did it editing /usr/share/X11/xkb/symbols/pc and adding key <RALT> { [ Return ] }; as the last instruction of xkb_symbols "pc105". This was many years ago and I haven't try again (change keyboard and laptop/OS) Sep 12, 2022 at 12:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .