By default, Caps Lock on Linux (X11 sessions) is only activated when you release the key, not when you press it.
This small tweak changes that behavior so Caps Lock toggles immediately on key press, just like in Windows or macOS.
- Makes
Caps Lockrespond instantly when you press it - Applies automatically when you log in
- Works with GNOME, XFCE, etc.
- No sudo/root needed
xkbcomp -xkb $DISPLAY ~/xkbmapnano ~/xkbmapFind this line:
key <CAPS> { [ Caps_Lock ] };
Replace it with:
key <CAPS> {
repeat=no,
type[group1]="ALPHABETIC",
symbols[group1]=[ Caps_Lock, Caps_Lock ],
actions[group1]=[
LockMods(modifiers=Lock),
Private(type=3,data[0]=1,data[1]=3,data[2]=3)
]
};
Save and close.
nano ~/.config/apply-caps-fix.shPaste:
#!/bin/bash
sleep 2
if [ -n "$DISPLAY" ]; then
xkbcomp -w 0 /home/$USER/xkbmap $DISPLAY
echo "CapsFix ran at $(date)" >> /tmp/capsfix.log
fiMake it executable:
chmod +x ~/.config/apply-caps-fix.shOptional: test it right away (without reboot):
~/.config/apply-caps-fix.shnano ~/.xprofilePaste this:
~/.config/apply-caps-fix.shMake sure .xprofile is executable:
chmod +x ~/.xprofileAfter reboot, press Caps Lock — it should toggle instantly.
You can also check the log file:
cat /tmp/capsfix.logJust delete:
~/xkbmap~/.config/apply-caps-fix.sh~/.xprofile
Then reboot.