22

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.

deprecated
  • 2,841
  • 4
  • 24
  • 22

1 Answers1

18

Use the following command:

setxkbmap -option caps:shiftlock
angus
  • 12,131
  • 3
  • 44
  • 40
  • 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 09 '21 at 08:02