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.

1 Answer 1


Use the following command:

setxkbmap -option caps:shiftlock
  • Well, I tried and this would make EVERY KEY in the keyboard work differently, as if you are pressing Shift all the time. Like arrow keys will output like shift+arrow, you cannot scroll up/down with mouse wheel, Ctrl+n will be like Ctrl+N, in terminal Delete will enter 2~ and so on. If you only want it for upper line number/symbols, I will say it is overkill.
    – WesternGun
    Jun 9, 2021 at 8:02

You must log in to answer this question.

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