Slow keys in Linux

“Slow keys” in Linux are an avoidable problem.

This drove me mad for some months now: Every now and then, after using my laptop for a while, the keyboard would become very unresponsive. It doesn't happen often when programming, but more often when doing graphics editing or managing photos in Shotwell.

At first, you think that they keyboard completely stopped working. Later, you realize that it simply only recognizes key presses after roughly a second of pressing down. It is still possible to type, but it's really a big pain.

It turns out, “slow keys” are really an accessibility feature, which activates itself when pressing down «shift» for more than eight seconds (which is not an unusual thing for me when using Gimp or Shotwell). Unlike Windows, which shows you a funny dialog box in this case, my Ubuntu derivate here simply slows down my keyboard without giving any hints what's going on.

Luckily, it's possible to disable it with:

apt-get install xkbset  # Install xkbset.
xkbset -sl  # Disable slow keys (if already active).
xkbset -a   # Disable accessibility to prevent it from switching on.

So, in short, if you put xkbset -a in one of your startup scripts, you can disable this feature completely.

As long as you're using the default Ubuntu Unity desktop, you can probably also use the Gnome Control Center.

Found on Michael Heap's weblog.