30

This is one of the wackiest and weirdest problems I have ever encountered. My keyboard was working absolutely fine untill yesterday on Ubuntu 13.04. However, when I boot to Ubuntu today, I suddenly find that all the keys work, but I have to press and keep on holding them for about a second for them to work.

  • This behavior is true for all the keys except for Num Lock, Caps Lock and Scroll Lock keys, the indicator for them on my keyboard lights up as soon as I press those keys.

  • The keyboard works fine at the login screen where I put my password.

  • The keyboard also works normally if I use the Guest session instead of my normal user account.

  • I have not done any key-remappings and using the standard English (US) keyboard layout.

  • I have fiddled around with the settings for Keyboard in System Settings, but to no avail.

  • I have Windows 7 as dual-boot and the keyboard works perfectly well on it.

Why am I facing such a behavior and how to normalize this?

PS: Using Logitech Classic Keyboard K100 (USB Model).

Radu Rădeanu
  • 169,590
Aditya
  • 13,416

11 Answers11

30

Because probably you put on the Slow Keys option from System SettingsUniversal AccessTyping. Turn it off:

slow keys

Radu Rădeanu
  • 169,590
  • I didn't think about that one... or more like, I totally forgot that there was one like that. – Braiam Oct 04 '13 at 21:03
  • 1
    @Braiam I can bet that many of us doesn't have idea about these features from Universal Access. – Radu Rădeanu Oct 04 '13 at 21:09
  • I can't confirm if this was the issue. I had already started following @Braiam's answer and deleted the 3 . folders before you posted this one... – Aditya Oct 04 '13 at 21:17
  • 1
    @Aditya If you made backups as Braiam said, you can restore them and check :) – Radu Rădeanu Oct 04 '13 at 21:20
  • 2
    @Aditya Ok, I'm sure this was the problem. Since Braiam's answer solved your problem, the same answer may offer some other "fixes", like losing some settings... But from now you know how to put a delay between when a key is pressed and when it is accepted :) – Radu Rădeanu Oct 04 '13 at 21:33
  • @Aditya you have to restart your session to break it again but this time you will be breaking it conscious of what you are doing. ;) – Braiam Oct 05 '13 at 01:24
  • @RaduRădeanu: I have been trying to restore those three . folders but my settings are not getting restored - I guess I would post a new question about how to restore that.. However, I just tried to turn ON the Slow keys and find that this was exactly the similar behavior that I was facing earlier. So, turning Slow keys OFF would have solved this question. If only you had posted this answer a couple of minutes earlier, I wouldn't have lost my settings :) – Aditya Oct 05 '13 at 13:42
  • 1
    I suppose there is a "hidden" shortcut that enables the Slow Keys. This is the 3rd time when the Slow Keys were somehow enabled in my system, it's really annoying! – ady Mar 28 '16 at 18:33
  • Very strange. Had the same problem and I definitely did NOT turn that on! Some program must have changed that setting... – reggie Aug 30 '16 at 20:13
  • In 18.0+ you have to click on "Repean Keys On" menu item to get to the speed settings (in case you were as confused as I am) – Dany Dec 09 '19 at 16:09
  • I noticed that this setting is under Typing Assist(assistX) in Ubuntu 21.10 – JoelParke Dec 19 '21 at 22:39
7

I had a similar problem. I stumbled on the answer while trying the solution here. Somehow the screen reader was turned on, and this was causing erratic behavior. Check it under System Settings → Universal Access → Seeing. Make sure the Screen Reader is set to OFF. Screen Reader OFF

user260596
  • 81
  • 1
  • 4
  • On 16.04 i solved the issue by following the answer about the screen reader that is given in this thread. In addition, to be sure not to inadvertently activate it, i disabled the screen reader shortcut in System settings -> keyboard -> shortcut -> universal access . – blonchkman Feb 11 '17 at 11:34
3

Ubuntu has apparently mirrored the "slow keys" functionality in Windows, and by default set this up so it's enabled by holding down Shift key for too long automatically turns on this setting!

The appearance of this setting in recent years has been driving many people nuts, and the habit of holding down Shift while thinking of what to type means that it's easy to turn on this setting by accident.

The accepted answer does not work anymore in latest version of Ubuntu, there is no "Slow Keys" option anymore in gnome-control-center.

The only way I've found to reliably disable this is via command line:

# Get current value of keyboard accessibility (enabled = true , disabled = false)
gsettings get org.gnome.desktop.a11y.keyboard enable
# Get current value of slowkeys-enable
gsettings get org.gnome.desktop.a11y.keyboard slowkeys-enable
# Turn it off!
gsettings set org.gnome.desktop.a11y.keyboard slowkeys-enable false

Get current value of stickykey-enable

gsettings get org.gnome.desktop.a11y.keyboard stickykeys-enable

Turn it off!

gsettings set org.gnome.desktop.a11y.keyboard stickykeys-enable false

Finally, turn the entire keyboard accessibility options off (this should disable the SHIFT key shortcuts)

gsettings get org.gnome.desktop.a11y.keyboard enable false

Pablo Bianchi
  • 15,657
TrinitronX
  • 3,254
1

I can not post a proper answer with images and all cause I am on a windows only public computer right now but, try going to the keyboard settings and check to see if there is a key sensitivity setting, then maybe you can adjust it there...also try unplugging keyboard and then plugging it back in. Maybe this will reset it... Just suggestions!

Hope it helps... Good Luck!

SoCalDiegoRob
  • 611
  • 1
  • 7
  • 17
0

As described in the question, in the login screen I had no delay but in the window manager (awesome wm), there was an irregular keyboard lag (sometimes short/long delay). Before, I had put the following code in /etc/X11/xorg.conf

Section "Device"
Identifier  "Card0"
Driver      "intel"
Option      "Backlight"  "/sys/class/backlight"
EndSection

to make xbacklight work. It turned out that the the above lines caused the keyboard delay in my case.

phinz
  • 121
0

TL&DR: Turn of Screen Reader through the Universal Access options in Ubuntu 20.04+.

Instructions:

  1. Open the Activities overview and start typing "Accessibility".

  2. Click Universal Access to open the menu.

  3. Click Screen Reader in the Seeing section, then switch the Screen Reader setting on in the dialog.

Explanation: The Screen Reader feature is really meant for those who have trouble reading, or are visually impaired. This has been shown to cause delays in keyboard presses.

FlyingV
  • 969
  • 6
  • 5
0

After much troubleshooting and trying all other solutions, I found one the possible problems: the Compton window manager. I suspect many others are seeing the same as this one and I have not seen this solution online yet.

If you are using xfce (i.e. XFCE) (or any other desktop that use compton), try disabling Compton.

In Mint, this is: Mint button > Session and Startup > Application Autostart tab > Untick Window Manager (Window Manager Startup)

If you hover your mouse over this option you will see that - at least for xfce - the command for this is xfce-autostart-wm. This file is located at /usr/bin/xfce-autostart-wm and happens to be a Python Script.

In this script, the command compton --backend glx --vsync opengl-swc is executed if your window manager is Compton.

To see what your configured Compton manager is, start python3 and do:

import sys
import os
import gettext
import subprocess
import gi
from gi.repository import Gio
settings = Gio.Settings("com.linuxmint.desktop")
print(settings.get_string("xfce-window-manager"))

i.e.

/usr/bin$ python3
Python 3
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import os
>>> import gettext
>>> import subprocess
>>> import gi
>>> from gi.repository import Gio
>>> settings = Gio.Settings("com.linuxmint.desktop")
>>> print(settings.get_string("xfce-window-manager"))
xfwm4-compton

Once I started compton --backend glx --vsync opengl-swc the key delay issue immediately starts happening.

Disable Compton and see how you go. If you use XFCE the following script update (sudo vi /usr/bin/xfce-autostart-wm) may suffice:

    #subprocess.Popen(["compton", "--backend", "glx", "--vsync", "opengl-swc"])
    subprocess.Popen(["compton", "--backend", "glx", "--vsync", "opengl-swc", "--xrender-sync", "--xrender-sync-fence"])

Around line 33.

Bug here: https://github.com/chjj/compton/issues/255

0

This could happen when there is a daemon program catching keystrokes (like onboard). As a trial, open gnome-system-monitorand look if there is any bash script or even python scripts running. Try closing onboard if it's running.

Python Student
  • 558
  • 6
  • 16
  • I don't find any process called onboard or other bash/python scripts running. – Aditya Oct 04 '13 at 18:28
  • @Aditya Do you have compiz installed? If so check there... Have you tried a defirent keyboard? Have you been using ununtu fine for awhile or did you just install it? – SoCalDiegoRob Oct 04 '13 at 20:37
0

I know that what I will recommend is almost the most easy and ugly solution out there:

Move the .* directories to somewhere else:

mkdir ~/backup
mv ~/.config ~/.dbus ~/.gconf ~/backup/

now restart your session. The problem should have go away. If the issue goes away, you can restore back one by one the innocent with

cp -nr ~/backup/.dbus ~/.dbus

Restart the session, issue is there again? Remove the directory and copy instead one by one the contents of the subdirectories. Same with the other 2 directories.

cp -nr ~/backup/.config ~/.config
cp -nr ~/backup/.gconf ~/.gconf

I know is quite brutish the method, but since I couldn't find the exact file/dconf/gconf/xinput that could cause this, a little quick hack should suffice.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • Then, if I had made any changes to settings in those folders intentionally/unintentionally, they would also go away.. – Aditya Oct 04 '13 at 20:22
  • Not necessarily, for that I asked you to move not remove files, check my updated answer. BTW, my method is quite like debugging, since it was a possible update that quirk the configurations, looking for them commenting in your question seems too long and answers should be the more generic as possible. – Braiam Oct 04 '13 at 20:31
  • Okay... I used cp -r (without the -n flag) and restored all the 3 . folders... Restarted the system and keyboard is still working fine... However, no setting seems to have been restored - I have lost settings related to wallpaper configuration, unity, date and time settings - the ones which are visible instantly are all lost.. – Aditya Oct 04 '13 at 21:16
  • Mm... that's not right. If you used cp -r and copied everything you should have everything there since cp by default replaces the files... something wicked was in your system. BTW, in the first attempt, where the configurations lost too? – Braiam Oct 05 '13 at 01:26
  • Braiam: I have been trying to restore the folders all along... but my settings are not getting restored. I would soon post a new question about restoring my settings. Anyways, thanks for your time; however following @Radu's answer would have solved this question :) – Aditya Oct 05 '13 at 13:44
0

Another possible reason for delay while switching keyboard layout: according to issue #1370953 (and #1370953), such behavior may be related to poor disk performance. See Maxim Kravets comment:

Every layout change alternates ~/.config/dconf/user file. Layout change is slow when disk is busy.

There is one thing (not only one) to step over disk issue - to change disk queue scheduler. By default Ubuntu is configured to use the deadline scheduler, however for a slower HDD its better to use cfq scheduler instead.

See instruction.

sempasha
  • 101
0

Inacceptable text entry lag might also have a completely different reason than the ones stated here (like Sticky Keys), and I found it:

By mistake I had the option 'Screen Magnifier' (Accessibility Options) switched on. That setting may slow texting down if you are running a low spec Netbook, like I do (ASUS X206HA)... It made me half crazy.

When I switched the Magnifier off, everything is back to quick and smooth again.