Under X, I can make Caps Lock behave as Esc when pressed briefly, but as Ctrl when held down with:
setxkbmap -option 'caps:ctrl_modifier'
xcape -e 'Caps_Lock=Escape' -t 100
How can I replicate this behavior under Sway / Wayland?
Under X, I can make Caps Lock behave as Esc when pressed briefly, but as Ctrl when held down with:
setxkbmap -option 'caps:ctrl_modifier'
xcape -e 'Caps_Lock=Escape' -t 100
How can I replicate this behavior under Sway / Wayland?
Put the following in your sway config:
input "type:keyboard" {
xkb_options caps:ctrl_modifier
}
Source: https://github.com/swaywm/sway/wiki#keyboard-layout
UPDATE: the OP asks for "Caps lock is an Escape but is a Control when held". Turns out there is a simple program that does exactly that at libevdev level (so works with any display server, Wayland or not, and the sway config above is not needed).
A related discussion thread: https://github.com/swaywm/sway/issues/719