Changing Caps Lock behaviour in Mint

Being in Belgium, I use the Belgian keyboard layout, which is based on the French one.

My problem involves the numerical keys above the regular letters. Unlike qwerty users, we need to use the shift button to get the numbers.

Normal : &é"'(§è!çà
Shift : 1234567890

Caps lock should behave like shift, but it doesn't. I get &É"'(§È!çÀ , which is basically the same as the normal ones but the é, è and à have been capitalized.

I've tried every variant of the Belgian layout and every setting of the caps lock behavior, and keep getting the same incorrect behavior.
Does anyone know a way to make caps lock act like a proper shift lock?

Using the numerical pad on the right is not an option on my laptop, and I have to use said laptop to do a lot of spreadsheet stuff for work.
Switching layouts is too much of an inconvenience, I'd have to do that 50 or more times in a single day then.

Here's a great guide of changing what a key does. http://askubuntu.com/questions/24916/how-do-i-remap-certain-keys-or-devices

Basically, if you want to change caps to shift lock, you'd have to know what keycode your caps key have and what shift lock is called, I guessed Shift_Lock and as you can see in the end it worked.

To find out what keycode your caps lock have, type
$ xev
in the terminal and press your caps key. my output is this. The first two are for pressing the key, and the third is releasing it. (Don't worry, if you assign a lock type key, it will not go back to not working at key release. It'll work just like caps.)

KeyPress event, serial 37, synthetic NO, window 0x4600001,
root 0xd9, subw 0x0, time 6319257, (231,20), root:(933,391),
state 0x0, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

PropertyNotify event, serial 37, synthetic NO, window 0x4600001,
atom 0x1a4 (XKLAVIER_STATE), time 6319258, state PropertyNewValue

KeyRelease event, serial 37, synthetic NO, window 0x4600001,
root 0xd9, subw 0x0, time 6320213, (231,20), root:(933,391),
state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

So my keycode for caps key is 66, so to make it into shift lock, I'd write in the terminal:

$ xmodmap -e "keycode 66 = Shift_Lock"

It works on my computer with mint.

Edit: formating.

You can of course use any key you'd like, like page up or page down (I'd use these as I never use them otherwise), if you still would like caps to just be good old caps.

Edit: also here is some talk about it. Seems the second responder also have keycode 66 for caps lock. http://unix.stackexchange.com/questions/224827/how-do-i-enable-shift-lock-sticky-shift-key

As far as im aware the default behaviour for any layout for capslock is to shift letters only, not symbols.

This works for me

setxkbmap -option caps:shiftlock

To set perminently I think this will work

/etc/X11/xorg.conf.d/00-keyboard.conf

Section "InputClass"
        MatchIsKeyboard "on"
        Option "XkbOptions" "caps:shiftlock"
EndSection

Alternatively if your using a system with systemd

localectl --no-convert set-x11-keymap caps:shiftlock

(remove --no-convert if you also want TTYs to have the same behaviour.)

That worked for me ... at least until reboot. Also key 66 on the main PC, I'll look into it on the laptop once I got it working here.


That worked for me too, again until I rebooted.


No such directory or file on 17.3. There is an xorg.conf folder, but nothing in there that looks like keyboard mapping, all synaptics and touchpad stuff.


This one completely screwed up my system. It changed the keyboard layout for the entire OS to a layout called "caps:shiftlock", which is some qwerty layout, I assume the default EN_US.
I removed that layout and set i back to Belgian, but my login screen is still in qwerty with no option to change it. Seeing as my password consists of several numbers and symbols, this really messed up my login.
Luckily I only tested it in a VM, so a re-install won't be a big deal.

Oh yes, I didn't try to reboot. Just tried it and mine set it to caps at reboot too. So I just set it as a custom command at startup and it works.

In cinnamon at least it is: startup applications --> "add" at the bottom of the window --> choose "custom command" fro mthe drop down menu--> under command write the command: xmodmap -e "keycode 66 = Shift_Lock" and give it a name if you fancy.

1 Like

That did the trick indeed. Thank you so much !

2 Likes

Happy to help :)

2 Likes

Ah I forgot your using a different layout.. Im not sure how I forgot. I think localctl requires all changes so youd specify language, layout, and options.

a xorg.conf.d folder?
The default these days it to allow configs in /etc/X11/xorg.conf.d

You'd just make the file in that folder. It used to make a xorg.conf file, but this is the old way and distros shouldnt use it now.

Oops, it's a xorg.conf.d folder indeed. Missed that ".d" bit. However that folder is not in /etc/X11/ but in usr/share/X11/

Thats where packages will put xorg config files. As a user, youd edit (and add the folder if it didnt exist) /etc/X11/xorg.conf.d, that way it doesnt get overwritten if a package updates it.

Ah, ok. So basically I should have created the /etc/X11/xorg.conf.d/00-keyboard.conf file with those 4 lines in it ?

Yes, though thinking about it. Its strange one doesnt exist as it should include your keyboard language and layout.

Mine for example

Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "gb"
EndSection

If you add an XkbLayout option along with the other option that should work. However since you have it working i wouldn't worry about it to much.