11

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?

4 Answers 4

11

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

5
  • 9
    Where do you find the list of codes? ie How did you know the code was ctrl_modifier? Jun 27, 2017 at 22:26
  • 3
    This doesn't seem to work on Wayland/Sway
    – djsumdog
    Feb 19, 2018 at 5:45
  • 1
    @djsumdog, the trick anon gave for wayland is gnome-shell specific. sway would have to implement their own version of this setting. alot of features that were handled by X11 will have to be handled by the window manager from now on. Feb 22, 2018 at 6:30
  • gsettings worked for my Arch Linux 2019.02.01, but, setxkbmap solution not working.
    – zw963
    Feb 26, 2019 at 14:17
  • 1
    gsettings work for me on Ubuntu on Wayland 20.04 and persisted after reboot. Oct 7, 2020 at 3:16
2

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.)

1

For sway you can use:

export XKB_DEFAULT_OPTIONS=caps:escape

before running:

sway

reference https://github.com/swaywm/sway/wiki

1
0

Here is a script which change Capslock to Ctrl, and change rightAlt to Capslock for GNOME + Wayland for Arch linux.

https://gist.github.com/zw963/e8156358b2029c4f5a6f0d57fb9f6143

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.