0

On KDE (and on GNOME as well), there was an option to swap Caps Lock and Escape key.

Setting to Swap ESC and Caps Lock

I was expecting this same setting window in i3, but I didn't find one. Is there any similar setting in i3?

1

You can use xmodmap to swap Escape and Caps Lock on any DE.

First create a file with the following contents:

remove Lock = Caps_Lock
keycode 0x42 = Escape
keycode 0x9 = Caps_Lock
add Lock = Caps_Lock

Let's suppose it is saved as swapkeys.

Run the following command to swap the keys:

xmodmap swapkeys -display :0

assuming $DISPLAY is :0.

You can add the above line to your i3 config to execute automatically on startup.

6
  • swapkeys will be the path to the file we created? – Santosh Kumar Jun 12 '19 at 8:18
  • @SantoshKumar yes – Shubham Kumaram Jun 12 '19 at 8:23
  • How do you write a comment in swapkeys file? # doesn't work. – Santosh Kumar Jun 12 '19 at 8:24
  • Comments start with ! – Shubham Kumaram Jun 12 '19 at 8:25
  • Is there anything similar to keep NumLock on at boot time? – Santosh Kumar Jun 12 '19 at 9:34
0

Also the following will do the same:

config file: ~/.config/i3/config or user defined

 xmodmap -e "clear lock"

 #disable caps lock switch
 xmodmap -e "keysym Caps_Lock = Escape"
 set caps_lock as escape

just for simple config at one place

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.