I'm experiencing a strange behavior with xmodmap. I want to remap Caps_Lock so it acts as Escape and Shift+Caps_Lock so it acts as Caps_Lock. In my ~/.Xmodmap i tried every possible combination of the following commands always with the same result:

clear Lock
remove Lock = Caps_Lock
keycode 66 =
keycode 66 = Escape Caps_Lock
keysym Caps_Lock = Escape Caps_Lock

The Caps_Lock gets properly remapped to Escape

$ xmodmap -pke | grep Caps
keycode  66 = Escape Caps_Lock Escape Caps_Lock

BUT after reboot it still does lock CAPS. So it acts as both Escape and Caps_Lock. Running xev i can see that the state switches between 0x10 and 0x12. While Shift+Caps_Lock works as expected (as Caps_Lock). If i run xmodmap ~/.Xmodmap in my terminal after logging in i get this as before:

$ xmodmap -pke | grep Caps
keycode  66 = Escape Caps_Lock Escape Caps_Lock

BUT Caps_Lock starts behaving as expected, only as Escape and does no longer lock CAPS.

I really dont get what am i doing wrong.

2 Answers 2


Finally found a way to make this work. I figured out that X keyboard extension yet offers an option for this. By looking at /usr/share/X11/xkb/rules/base.lst i found the following line:

caps:escape_shifted_capslock Make unmodified Caps Lock an additional Esc, but Shift + Caps Lock behaves like regular Caps Lock

So i simply needed to add caps:escape_shifted_capslock to XkbOptions inside /etc/X11/xorg.conf.d/00-keyboard.conf this way:

Option "XkbOptions" "terminate:ctrl_alt_bksp,caps:escape_shifted_capslock"

After reboot Caps_Lock and Shift+Caps_Lock were behaving exactly the way i wanted.


I followed the example from the xmodmap wiki for 'CapsLock to Control and Shift+CapsLock to CapsLock' and it worked.

clear lock
keycode 66 = Escape Caps_Lock NoSymbol NoSymbol

You might need to log out and in again.

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.