Disable Keyboard Repeat from command line?

Is it possible to disable the keyboard repeat functionality, as is needed by various Flash games, through the command line?

Normally it can be disabled by going to settings -> keyboard and hitting the button, but I'm wondering if there's a command line / programmatic solution which I can implement into a program of mine.


Solution 1:

You can use the xset utility, which works on the X.org level, across desktop environments. (The dconf / gsettings solution is Gnome specific.)

To switch off keyboard repeat:

xset r off

To switch keyboard repeat on again, with the same delay and rate settings as before:

xset r on

See man xset for details.

Solution 2:

Of course it should be possible :)

Open the Terminal and execute the following command to disable it:

dconf write /org/gnome/settings-daemon/peripherals/keyboard/repeat false

If you want to set it to default value, use reset option as following:

dconf reset /org/gnome/settings-daemon/peripherals/keyboard/repeat

From man dconf:

dconf write KEY VALUE
dconf reset [-f] PATH
  • write: Write a new value to a key.
  • reset: Reset a key or an entire directory. For directories, -f must be specified.

Also you can use gsettings instead of dconf:

gsettings set org.gnome.settings-daemon.peripherals.keyboard repeat false

From man gsettings:

set    #  gsettings set SCHEMA [:PATH]  KEY VALUE
   Sets the value of KEY to VALUE. The value is specified as a serialised GVariant.

reset  # gsettings reset SCHEMA [:PATH]  KEY
   Resets KEY to its default value.