9

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).

muru
  • 197,895
  • 55
  • 485
  • 740
Magnus Teekivi
  • 245
  • 1
  • 2
  • 6

1 Answers1

7

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

Rmano
  • 31,947