I use i3wm, and to map cap lock to escape, I run:
setxkbmap -option caps:swapescape
This works fine, but sometimes while hitting the F1 key, my pinky can accidentally hit the Escape key, which turns on CapsLock.
Gnome has a very nice way to do this, where Shift + Escape = CapsLock. Hitting Escape on its own will do nothing.
It’s option
caps:escape_shifted_capslock
I think.You can look through
/usr/share/X11/xkb/rules/base.lst
for all the options.Edit: Just looked up when this was added, this is a new option from 2024:
https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/commit/6bf17ba73bd94dd02e036a8c99c4a684a83f13fb