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 2013-03-31 11:21:54 +0000

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?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
5

answered 2013-03-31 13:45:34 +0000

vandannen gravatar image

updated 2013-03-31 13:46:15 +0000

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
edit flag offensive delete link more

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 ( 2013-04-09 15:47:46 +0000 )edit

Worked for me!

ethanmad gravatar imageethanmad ( 2015-04-24 01:03:16 +0000 )edit
2

answered 2013-03-31 12:13:05 +0000

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.

edit flag offensive delete link more

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 ( 2013-03-31 14:32:21 +0000 )edit
1

answered 2013-04-09 15:36:15 +0000

schischi gravatar image

You can also use:

setxkbmap -layout us -option caps:escape
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-31 11:21:54 +0000

Seen: 2,176 times

Last updated: Apr 09 '13