caps lock as esc and ctrl

caps lock as esc and ctrl

intended behavior

  • tap caps lock once => esc.
  • hold caps lock with another key => ctrl.
  • swap caps lock and ctrl.

KDE cannot do this alone.
xkb-options can only swap keys.
so we gon use keyd.
pls undo the keybinds in kde plasma if you have enabled it before. (System Settings → Keyboard → Key Bindings)

1. install keyd

doas pacman -S keyd

2. make the keyd config

write this to /etc/keyd/default.conf:

[ids]
*

[main]
# Tap: Esc. Hold: Ctrl.
capslock = overload(control, esc)
# Physical Ctrl becomes Caps Lock (this replaces the old swap)
leftcontrol = capslock

3. start keyd

doas systemctl enable --now keyd