How do I set caps to BOTH control and escape in ubuntu/gnome?
I've seen a few questions about this, but none that answered it to my satisfaction.
The question:
"I'm on ubuntu-flavored linux. I want to use caps as an escape and a control at the same time. (Esc on tap, control on hold). Karabiner lets me do this in Mac. Is there an easy way to do it for me?"
Previous stabs at the question:
- How do I install caps2esc?
- Remapping Caps Lock to Control and Escape (not the usual way)
- Overload capslock with esc and ctrl using xcape
Solution 1:
- Don't use xmodmap. It's a trap!
- Install xcape
- Use gnome-tweaks to turn capslock into control
- Use xcape -d to verify that capslock is key 66
- Set
xcape -e '#66=Escape'
in Startup Applications or ~/.profile
That's it!
No xmodmap. No crazy systemd settings. No dconf. It just works.
Solution 2:
This is possible based on
# make CapsLock behave like Ctrl:
setxkbmap -option ctrl:nocaps
# make short-pressed Ctrl behave like Escape:
xcape -e 'Control_L=Escape'