11

If I set keyboard repeat rate with say xset r rate 250 100, disconnect my usb keyboard and then run xset -q, I can see that after disconnecting the keyboard repeat rate is automatically set to the following default values:

$ xset -q | grep delay
  auto repeat delay:  660    repeat rate:  25

Can I change the default values? Where are they stored? I'm running Debian Sid.

3 Answers 3

9

You can change the so-called seat-defaults in /etc/X11/xinit/xserverrc by adding the relevant parameters (cf. XSERVER(1)).

-ardelay milliseconds
   sets the autorepeat delay (length of time in milliseconds that a key must be depressed before autorepeat starts).

-arinterval milliseconds
   sets the autorepeat interval (length of time in milliseconds that should elapse between autorepeat-generated keystrokes).

(!) For figuring out the arinterval in ms from xset repeat frequency, compute 1000/freq.

Mine now says exec /usr/bin/X -nolisten tcp -ardelay 200 -arinterval 20 "$@"

[found on https://superuser.com/questions/935801/whenever-i-plug-in-another-keyboard-key-repeating-rate-is-reset-to-some-value]

(I used to try to make the repeat rate permanent by setting Option "AutoRepeat" "190 70" /etc/X11/xorg.conf.d/keyboard.conf, but that wouldn't stick, so I (helplessly) resorted to running a per-minute xset cron job XD)

2

When we change the settings at a bash prompt, the new settings seem to be stored only in the memory of the running X Server.

To make the changes persistent, you may have luck uncommenting the "KEYBOARD_RATE" and "KEYBOARD_DELAY" lines in /etc/kbd/config if your system has that file.

Otherwise (for Ubuntu, anyway), there tend to be various distro-specific approaches, see: https://askubuntu.com/q/140255/231504

Here's why I'm guessing the values set via xset only live in-memory in the X Server:

When I run the command under strace, like so:

strace xset r rate 175 37

It seems (based on my limited experience with strace) that the settings are written to a socket, and on my machine the socket is:

/tmp/.X11-unix/X0

To see what's on the other end of that socket:

sudo lsof +d /tmp/.X11-unix

... which outputs:

COMMAND  PID USER   FD   TYPE             DEVICE SIZE/OFF   NODE NAME
Xorg    1635 root    3u  unix 0xffff88046ae4bc00      0t0  24945 /tmp/.X11-unix/X0 type=STREAM

...which shows that the process listening to the socket is Xorg (aka The X Server). Of course, the X Server could then hypothetically persist the values to non-volatile memory somewhere, but based on multiple anecdotes from users, it would seem that's not the case.

2
  • 2
    downvoting an answer without a comment is unhelpful. I upvoted the answer so it gets back to 0.
    – parity3
    Commented Feb 16, 2023 at 20:13
  • Upvote because I didn't know about strace
    – Cristian
    Commented Apr 27, 2023 at 18:52
1

Maybe https://github.com/SFTtech/xautocfg helps you.

It can automatically set the keyboard repeat rate for newly connected devices, and can run as a your user - it gets notified by the X server when a new device was detected.

You must log in to answer this question.

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