7

I have the following is my .xinitrc:

xset r rate 250 100 &

Which sets the repeat rate when you are holding a keyboard key to a pretty high value. However, whenever I plug in another keyboard, the rate is reset to a much lower one. Why could that be happening and how do I fix it?

Might that be somehow related to the fact that one of the keyboards is a PS/2 one and the other is a USB one?

3 Answers 3

11

I solved the same problem by editing my ~/.xserverrc.

It looks like this:

exec /usr/bin/X -nolisten tcp -ardelay 300 -arinterval 25 "$@"

It's equivalent to xset r rate 300 40, because xset uses frequency while X startup options use a delay (1000/40Hz = 25ms). In your case ardelay would be 250 and arinterval would be 10.

Note that I'm using startx to launch my X session but your display manager (if you use one) might not read your xserverrc. Gnome also seems to override the rates even when launched with startx.

I am using a USB keyboard that is attached to my laptop so I doubt PS/2 is related to this.

3
  • I'm using Arch linux and it works perfectly. Had to restart the x server.
    – kevin
    Oct 29, 2015 at 20:07
  • 2
    yeah proper solution. /etc/X11/xinit/xserverrc is the global default (on Debian).. I used to have a cron job before doing an xset call every minute as a silly hack..
    – eMPee584
    Aug 6, 2018 at 3:25
  • The xset cronjob also added for me a slight delay to input at the beginning of each minute. It was driving me nuts.
    – danuker
    Dec 13, 2020 at 7:26
2

Neither editing my ~/.xserverrc nor my /etc/X11/xinit/xserverrc worked.

I did a ps aux | grep X to find out how my X server was launched. I found this:

/usr/lib/Xorg -background none :0 vt01 -nolisten tcp -novtswitch -auth /var/run/lxdm/lxdm-:0.auth

I thankfully see lxdm in there. This means my Xorg session was started by LXDM. Yes, I remember choosing that desktop manager now.

I look at LXDM settings, which for Arch Linux are in /etc/lxdm/lxdm.conf.

There I find a line starting with arg=, which shows the params passed to the X server. That is where I appended -ardelay 300 -arinterval 25.

I am thrilled that it worked for me. Hopefully this general procedure lets you discover your own desktop manager and works for you too!

1

I've created https://github.com/SFTtech/xautocfg to solve this problem.

It can set the keyboard repeat rate automatically once it gets the event from the X server that there's a new keyboard.

Normally your desktop environment should apply this configuration, but I suppose your DE doesn't support this.

xautocfg doesn't need root privileges and runs as your user (preferrably as systemd user service).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .