Whenever I plug in another keyboard, key repeating rate is reset to some value

Solution 1:

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.

Solution 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!