- Send Escape if you tap Caps Lock alone.
- Send Control if you press Caps Lock with another key.
- send caps lock if you press both shift keys together
For vim , emacs and normal day typing
Install XCAPE (xcape
). (Linux utility to configure modifier keys to act as other keys when pressed and released on their own.)
Ubuntu:
sudo apt-get install xcape
# make CapsLock behave like Ctrl:
setxkbmap -option ctrl:nocaps
# make short-pressed Ctrl behave like Escape:
xcape -e 'Control_L=Escape'
The effect should apply immediately.
Append code from Step 2 to file ~/.xprofile
to run the command when X starts.
- Download and install Karabiner-Elements, a powerful and stable keyboard customizer.
- Open Karabiner-Elements, select Complex Modifications tab, and click Add rule at the bottom.
- Find Post escape if caps is pressed alone, left_ctrl otherwise and click on enable.
The effect should apply immediately.
- Download and install AutoHotKey.
- Use the script CapsLockCtrlEscape.ahk.
This was made possible with a third party software called AutoHotkey Usually the Altimate automation script for windows systems. I choose to use these program since i plan to do some automations with in window with it.
I admit i did not write the script for this program myself by i sourced out from github.
This script came with something additional that i loved. I did not lose the caps lock fuctionality as in my linux distro. Pressing the two shift keys together
activates thes caps lock.