By default I have the following key mapping:

$ xmodmap -pke
keycode  49 = oe OE oe OE leftdoublequotemark rightdoublequotemark leftdoublequotemark
keycode  66 = Caps_Lock NoSymbol Caps_Lock

I assigned Ctlr to keycode 66 by doing $ setxkbmap -option "ctrl:nocaps"

Now I'd like to assign Caps Lock to keycode 49.

I did:

$ printf "keycode  49 = Caps_Lock NoSymbol Caps_Lock" > ~/.Xmodmap
$ xmodmap ~/.Xmodmap

The result was that pressing keycode 49 activates Caps Lock but pressing it again doesn't deactivate Caps Lock...

How could I toggle Caps Lock by pressing keycode 49?

1 Answer 1


With the set up mentioned in the question, Caps Lock can be activated by pressing keycode 49 and desactivated by pressing Shift + keycode 49.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .