15

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?

frans
  • 1,169

5 Answers5

15

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

anon
  • 151
  • 3
7

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.

Destroy666
  • 12,350
ntninja
  • 398
2

For sway you can use:

export XKB_DEFAULT_OPTIONS=caps:escape

before running:

sway

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

1

In my case, setxkbmap didn't work, and I used the KDE system settings:

Settings -> Keyboard -> Key Bindings -> Configure Keyboard Options

system settings

Krish
  • 111
  • 2
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

Script contents is:


#! /bin/bash

if ! fgrep -qs 'ctrl:new_ctrl = +new_ctrl(new_ctrl)' /usr/share/X11/xkb/rules/evdev; then sudo sed -i.bak '/ctrl:nocaps[[:blank:]]=[[:blank:]]+ctrl(nocaps)/a
ctrl:new_ctrl = +new_ctrl(new_ctrl) ' /usr/share/X11/xkb/rules/evdev fi

cat <<'HEREDOC' |sudo tee /usr/share/X11/xkb/symbols/new_ctrl partial modifier_keys xkb_symbols "new_ctrl" { replace key <CAPS> { [ Control_L ] }; modifier_map Control { <CAPS>, <LCTL> }; replace key <RALT> { [ Caps_Lock ] }; modifier_map Lock { <RALT> }; }; HEREDOC

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

for to disable this run

gsettings reset org.gnome.desktop.input-sources xkb-options

Rohit Gupta
  • 5,096
zw963
  • 101