I've got the following in the file ~/.Xmodmap
! change CapsLock to Escape
clear Lock
keycode 0x42 = Escape
It remaps the CapsLock key to Escape, and works pretty well, when I issue the comman xmodmap ~/.Xmodmap
. However, it does not always work when I boot my laptop. But sometimes it works!
Does anyone have a clue what's going on? How can I try to troubleshoot this?
I would look into
~/.xinitrc
, but there is a myriad of other possibilities depending on your window manager or desktop environment (see, for example, How do I set Xmodmap on login?). There is not enough information in the question to find it out.But remapping CapsLock to Escape is one of the canonical mappings provided by the the XKB extension, as listed in
man xkeyboard-config
. Just issueand voilà, CapsLock is an Escape. It can be made persistent by editing the "XKBOPTIONS" line of
/etc/default/keyboard
:Debian and Ubuntu set the keyboard based on that very file, so it is a reliable solution. You can delete
.Xmodmap
then and just make sure no other program meddles with the keymap.