[HOW TO] Fix the Linux Caps Lock delay issue, where CAps LOck lags behind

So what's the issue?

LEt's get straight to the topic. IF you have been using LInux for a while and used CAps LOck you might have noticed... yeah, THis thing. That terrible delay where the Caps Lock seemingly doesn't register your inputs correctly.
Thankfully, though, hexvalid fixed it for all of us Caps Lock users in https://github.com/hexvalid/Linux-CapsLock-Delay-Fixer.

What do I need

  • git (you can also manually download the .zip from the GitHub page, though)

So how do I fix it?

Open up a terminal (Super key, type Terminal) and type:

git clone https://github.com/hexvalid/Linux-CapsLock-Delay-Fixer
cd Linux-CapsLock-Delay-Fixer
bash -ic sh bootstrap.sh

Voilá. For the entirety of your session, you will no longer be haunted by the CAps LOck delay issue. BUT DON'T CLOSE YOUR TERMINAL YET!

Making it permanent

If you're satisfied, tested it out somewhere else, and didn't close your terminal, first move it somewhere tidy by doing:

sudo mv bootstrap.sh fixpatch /usr/local/bin
For non-sudo users

If you don't have sudo perms, let's just place it somewhere else:

mkdir -p ~/scripts
mv bootstrap.sh fixpatch ~/scripts

Don't forget when using Startup Applications later that you need to set the command to ~/scripts/bootstrap.sh!

Adding it to Startup Applications

There's many ways to open it at startup, the easiest way is using Startup Applications.
Open the Zorin Menu or Activities (Super key) and type Startup Applications

Then just add a new entry to it, like this:

You can now delete the repository by doing

cd ..; rm -rf Linux-CapsLock-Delay-Fixer

Note: I realized there's a few oversights here and there, and can't edit the post.

When doing bash -ic it might not do anything. It worked on my machine, though, but doing ./bootstrap.sh will suffice.

Another oversight is the fact it can't create the temporary files in /usr/local/bin/. Either chmod +w /usr/local/bin which might be bad practice or you need to edit the script to add /tmp/ to the temporary files (which could be also fixed with tr)

The guide for non-root users works fine, though.


I am one of those people who uses CAPS LOCK to capitalize text, so the issue is quite annoying on Linux distros where there is a delay. I had found a fix for this, which included changing the key<CAPS> data in a keyboard map and reloading the keyboard map to my keyboard. This fix no longer works in Ubuntu 21.04. Here's what I was doing before:

// Create keyboard map
xkbcomp -xkb $DISPLAY myxkbmap
nano myxkbmap

// Replace the part that says key<CAPS> with this:

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) ]   };

// Reload the file
xkbcomp myxkbmap $DISPLAY

It should be noted that this is not a perfect fix. When typing quickly you'll notice that the word I'm will result in I"m. This is a major improvement over I'M nonetheless.


Hope this had helped you.

1 Like