How to remap CAPS LOCK on Wayland?

Before Fedora switched to Wayland I used this .Xmodmap file to use my CapsLock Key to reach German Umlauts:

keycode 66 = Mode_switch Multi_key
keycode 20 = minus underscore ssharp
keycode 34 = bracketleft braceleft udiaeresis Udiaeresis
keycode 47 = semicolon colon odiaeresis Odiaeresis
keycode 48 = apostrophe quotedbl adiaeresis Adiaeresis

On Wayland this does not work any more - CapsLock would just work as before.

Is there a way to achieve the same result in Wayland, too?


For gnome you can use

gsettings set org.gnome.desktop.input-sources xkb-options "['caps:ctrl_modifier']"

While the preferred way for X is now

setxkbmap -option caps:ctrl_modifier

instead of xmodmap i believe. See this bugreport


For completeness: Under KWin/KDE you can remap Caps-Lock (and a few other control keys) quite flexibly using System settingsInput DevicesKeyboardAdvanced.

In particular you can set the Key to choose the 3rd level to Caps Lock to achieve your particular configuration.

– Much better than using Alt Gr when programming and losing Caps Lock in return is not really a loss at all.

(Die deutsche Bezeichnung ist übrigens: SystemeinstellungenEingabegeräteTastaturErweitertTaste zum Wechsel in die dritte TastaturebeneFeststelltaste.)