I know how to use xmodmap to remap the Caps lock key so it acts as a Control key, or as an Escape key. I would like to combine both features as follows:
When I push, then release, the Caps lock key, it sends Escape. When I hold down Caps lock and push another key (say A), it send Control-A.
Is there some combination of xkb, xmodmap and something else that could make Caps lock behave this way in X?
I'm using Ubuntu Precise on a Macbook Air 3,1.
gnome-tweak-toolto mapCaps LocktoCtrlas there is noKeyboard layoutinSystem Settingson Ubuntu 14.04. Thenxcape -e 'Control_L=Escape'didn't work, but after usingxcape -dI've discovered thatCaps Lockgenerates keycode 66 and remapped it respectively:xcape -e '#66=Escape'. – Sergiy Belozorov Sep 04 '14 at 10:08
– Louis Simoneau Aug 04 '15 at 10:06setxkbmap -option 'caps:ctrl_modifier'xcape -e 'Caps_Lock=Escape'setxkbmap -option 'caps:ctrl_modifier'xcape -e 'Caps_Lock=Escape;Control_L=Escape;Control_R=Escape'xcape -e 'Control_L=Escape'– glortho Apr 27 '18 at 18:06