How to make Caps Lock change keyboard layout without delay?

Solution 1:

I use Shift + Caps Lock to trigger the keyboard layout switch.

When using both layouts, I very frequently switch back and forth, and the switch seems instantaneous. That is, I never experience a hang (and I'm a fast touch typist - on both layouts).

Maybe worth considering?

Solution 2:

Though not a fan of apple, the observation in a SOLVED thread (on apple.com) that switching on the Caps Lock light (or keeping it lit? whatever... ) could be causing a delay might be a pointer into the right direction: the work-around suggested in the thread involves using 3rd-party software to emulate certain key combinations.

What comes to mind as an equivalent in the Linux world is xdotool (see the man page, which has some basic examples). Specifically to your case, you may want to try sth like xdotoolkeyCaps_Lock as used in yet another SOLVED thread (on ubuntuforums.org).

According to my own experience (unless you're willing to really go a level deeper) you'll have to play around with different key combinations and xdotool to find the magic combination which really does work smoothly. But definitely worth giving it a try!

Solution 3:

cd /usr/share/X11/xkb/symbols
sudo cp capslock capslock.bak
sudo sed -i 's#key <CAPS> {\t\[\tISO_Next_Group,\tCaps_Lock\t]\t};#key <CAPS> {        repeat=no, [ ISO_Next_Group, Caps_Lock ] };#' capslock

Update:

You also have to release the Caps Lock before pressing another key.

Related: https://askubuntu.com/q/264127/20275