I currently have Caps Lock mapped to Ctrl when held and Esc when tapped (for vim) via these commands in .xinitrc
setxkbmap -option 'caps:ctrl_modifier'
xcape -e 'Caps_Lock=Escape'
This works, but leaves me without Caps Lock so I want to remap Esc to Caps Lock.
I've tried setting it with xmodmap -e 'keycode 9 = Caps_Lock'
but that overrides the mapping on the Caps Lock key as well.
Is there any way to achieve these mappings?
Caps Lock -> Ctrl and Esc
Esc -> Caps Lock
setxkbmap -option 'caps:swapescape' -option 'caps:ctrl_modifier'; xmodmap -e 'keycode 255 = Escape'; xcape -e '#66=Escape'
works. 66 is the code for caps on my keyboard.Caps_Lock=Escape
can't be used because thesetxkbmap
already gave Esc the Caps_Lock keysym (if I understand correctly). Post your comment as an answer and I'll accept it. – hopibel Feb 15 '17 at 9:08