Switch Between Numbers and Symbols on Caps Lock

keyboardkeyboard-layoutxkb

Is it possible to set caps lock to switch between inserting numbers and the symbols they normally trigger when one holds shift?

e.g. when you normally press the 9 key, you get a ( unless caps lock is on.

I tried adding this line to my layout file, on /usr/share/X11/xkb/symbols:

key <AE05> {        [ percent, 5 ]       };

This effectively switches the 'normal' and 'shift' meanings, but it won't work on caps lock – only on shift.

Best Answer

Use the following command:

setxkbmap -option caps:shiftlock
Related Question