Fix CAps LOck delay in Ubuntu 21.04

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.

This works in almost every distro and has historically worked for me in every Ubuntu version to date. When I attempt this in 21.04, it doesn't work and I'm greeted with this warning after creating the keyboard file:

Warning: Could not load keyboard geometry for :0 BadName (named color or font does not exist) Resulting keymap file will not describe geometry

This is the only difference that I noticed between creating the fix on 20.10 and 21.04, yet when I make the changes and reload the file it doesn't fix the issue.

Any ideas on how to fix this? I'm not going to start using shift haha I would rather use Windows. Clearly, they changed something between 20.10 and 21.04 that's affecting this.


Solution 1:

Ubuntu 21.04 uses Wayland as its default display server, not Xorg. Xorg-specific configuration and tweak tools (which xkbcomp is) will not work on Wayland.

As a temporary measure, I would recommend to just not use Wayland until it's ready and has a considerable user base. Without an active user base, there is always way too many bugs and no one to fix them.

To switch to Xorg:

  1. Log out.

  2. Click on your profile.

  3. On the bottom right corner a display server selection button will appear. Click on it and select Ubuntu on Xorg.

    Display server choice

  4. Now log back in and everything should work.