Ubuntu: Where to put xmodmap command execution for remapping CapsLock to Esc?



Question:

I am a vim user and I use Esc frequently so I mapped Caps Lock to Esc.

I currently have this in my ~/.profile:

# remap Esc to Caps Lock  xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'  

The problem is that every time I suspend my computer or even lock the screen, the mapping of Caps Lock goes back to its default.

My question is, where should I put this line so that the remap remains even after suspension and locking the screen (etc).


Solution:1

The problem is that xmodmap is deprecated, and the keyboard layout is resetted at strange times. See if https://askubuntu.com/a/464618/16395 can help you.

In gnome-shell you can achieve this thing by setting, in gnome-tweak-tool, one of these options:

gnome tweak tool screenshot editing caps lock behavior

You should be able to find an equivalent thing for Elementary.

See also https://askubuntu.com/a/629043/16395 and Map AltGr-[a..z] and Shift-AltGr-[A..Z] to greek letter


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »