loading...
Cover image for Keyboard optimizations in GNU/Linux

Keyboard optimizations in GNU/Linux

aminnairi profile image Amin ・2 min read

Today I'm going to show you a simple command to enhance the repeating keys on a GNU/Linux operating system. After reading this article, you'll be able to:

  • Change the delay at which a key starts to enter in repeat mode
  • Change the rate between each repeat of the key
  • Save these settings so that you can reuse them for other machines as well
$ xset r rate 250 60

Before you try this command, I suggest you start hitting a key until it starts to repeat automatically. Now copy/paste the command I just showed you in the terminal and notice how the repeating is now faster.

The delay is the moment before a key start going into repeat mode. You can adjust the speed at which it occurs by increasing or decreasing the value 250 in the command.

Whereas the rate is the speed at which a key will repeat itself. This is the value 60 I just set in the above command. Start by typing something like a script or write a program right now to get used to it. If you find it too slow or too fast, you can still change the rate and run this command again.

One last thing to note: this setting will last as long as the session lasts. So if you really want to go back to your stock settings, you just have to logout/login (or reboot your computer). And since it won't stick between logout/login, you'll have to write them in your *rc file, for instance for Bash:

$ vim ~/.bashrc
#!/bin/bash

# Your pre-existing configuration here...

# Update the repeat delay and rate of the keyboard
$KEYBOARD_REPEAT_DELAY=250
$KEYBOARD_REPEAT_RATE=60
xset r rate $KEYBOARD_REPEAT_DELAY $KEYBOARD_REPEAT_RATE

Note that xset should be already installed on most of the GNU/Linux distributions out there and chances are that there is a package available for your distribution if it does not come pre-installed.

Also, this tip will only work with graphical environments. You can look at kbdrate if you want to update your keyboard rates & delays under a TTY session.

Posted on May 13 by:

Discussion

markdown guide