The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

change Caps Lock to Esc in i3

asked Mar 31 '13

elvis gravatar image

I use vim and i am accustomed to replace the function of caps lock with esc. So, my problem is how could i switch them in i3?

3 answers

Sort by » oldest newest most voted
5

answered Mar 31 '13

vandannen gravatar image

updated Mar 31 '13

you can modify your keyboard layout with xmodmap. To replace the caps_lock functionality with escape you could execute the following commands on startup:

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

Comments

but i would not have "Caps_Lock" function. Are there any way to switch them instead of removing the "Caps_Lock" ?

elvis gravatar imageelvis (Apr 9 '13)edit

Worked for me!

ethanmad gravatar imageethanmad (Apr 24 '15)edit
2

answered Mar 31 '13

I don't know a direct i3 solution but you could bind the escape key to xdotool:

bindsym Escape exec xdotool key 66

(66 being the keyCODE for Capslock, maybe check it using xev). Xdotool is available via package management in at least Ubuntu and Arch Linux.

Comments

Note that this is the wrong way around and involves executing a new process every time you press a key. See the other answer instead for the proper solution.

Michael gravatar imageMichael (Mar 31 '13)edit
1

answered Apr 9 '13

schischi gravatar image

You can also use:

setxkbmap -layout us -option caps:escape

Question Tools

Stats

Asked: Mar 31 '13

Seen: 2,176 times

Last updated: Apr 09 '13