Remap Capslock to Escape and Ctrl
Remap Capslock to Escape and Ctrl
In this post I’m gonna be showing you how I remapped capslock to ctrl when you hold it, and esc when you tap it.
The need for this comes from people using window managers, or keyboard driven text editors like vim, and emacs or just you use the ctrl key a lot and you hate the weird motion you have to do to get to it.
Capslock is a useless key in the perfect postion
– Geeks
Installing The Packages
The programs I used to achieve this are xcape
, and setxkbmap
. Which can be installed
like so on arch based systems.
|
|
How to use them
xcape
allows a key to be treated as another key when pressed for a short period of time.
setxkbmap
, the man page states it can be used to map the keyboard to use the layout
determined by the options that are passed to it, and we are going to use it to swap
capslock with ctrl.
The setup
To swap the Capslock key with The Ctrl key:
|
|
Since the Capslock key now acts as a ctrl key, we tell the xcape to make the Ctrl key behave as Escape key when pressed for a short period of time.
|
|
Now combine These put them in a script and make them run on a startup.
|
|
For example
|
|
Your Done