Home

Persistent key repeat under X

Written on 2021-05-16

A typical way of setting key repeat under X is to use xset, by having something like xset r rate 250 55 in one's .xinitrc.

This works fine for simple use cases but is fairly fragile to changes in devices. For example, the key repeat value is lost after unplugging and plugging back in an external keyboard, or when switching displays, which can quickly become frustrating. Instead, the key repeat values can be passed directly to the X server when starting it up, in which case it will be persistent. For example, using startx:

startx -- -ardelay 250 -arinterval 15

Note that those options must obviously be supported by the X server, which is the case at least for Xorg. When using it, also note that the delay parameter doesn't behave the same as with xset r rate, so you'll need to adjust it's value to your preference.