Automatic run-time configuration for X11
Features:
- Automatic keyboard repeat rate configuration. When a new keyboard is connected and used by X11, configure its repeat rate to desired values.
dependencies:
C++20
libX11
libXi
building:
- run
make
You should install xautocfg
through your linux distribution, so that all necessary files are managed and updated by your package manager.
Then:
- place config in ~/.config/xautocfg.cfg
- run
xautocfg
manually or: - enable/use the systemd user service (which needs
graphical-session.target
!):systemctl --user enable xautocfg.service
systemctl --user start xautocfg.service
The systemd
service binds to the graphical-session.target
which is started by your desktop environment.
Some window managers (e.g. i3 in 2022) don't start graphical-session.target
, so you need custom user service files.
As an example, these files are needed for i3 as long as it doesn't start the target on its own.
~/.config/systemd/user/i3-session.service
:
[Unit]
Description=i3 window manager session
PartOf=i3-session.target
Wants=i3-session.target
# this service is started by i3 in its config file
# it's done like this so i3 and its launched child processes
# are not a service itself, but in the regular session scope.
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
Restart=on-failure
~/.config/systemd/user/i3-session.target
:
# this target is wanted by i3-session.service (started by i3 config file)
[Unit]
Description=i3 Session
Requires=basic.target
BindsTo=graphical-session.target
Before=graphical-session.target
DefaultDependencies=no
RefuseManualStart=yes
RefuseManualStop=yes
Requires=basic.target
StopWhenUnneeded=yes
and finally in your i3 configuration file:
exec --no-startup-id systemctl start --user i3-session.service
it remains to be solved how we can reliably stop i3-session.service
once i3 has exited.
As alternative to this tool, you can set defaults for the X Server at startup.
- For the keyboard repeat rate:
X -ardelay 200 -arinterval 20 # (interval is 1000/rate_in_hz)
For this to configure, you need the privileges to edit X launch properties (probably in your login tool like lightdm
).
XServer since version 21.1.0 supports the option AutoRepeat
.
Basically you need an xorg config section like this (the second value again 1000/rate_in_hz
):
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "AutoRepeat" "200 20"
EndSection
Please join our matrix room: #sfttech:matrix.org
!
For bug reports and patches, please create issues and pull requests at https://github.com/SFTtech/xautocfg
Licensed under GPLv3 or later.