Giter Club home page Giter Club logo

xautocfg's Introduction

xautocfg

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.

Setup

Installation

dependencies:

  • C++20
  • libX11
  • libXi

building:

  • run make

Running

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

systemd setup for window managers

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.

Alternative setup ideas

XServer startup options

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 configuration file

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

Contact

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

License

Licensed under GPLv3 or later.

xautocfg's People

Contributors

thejj avatar mic-e avatar

Stargazers

M avatar Martin Rykfors avatar Sławomir Stępień avatar Shree Kottes avatar  avatar vandov avatar fengwk avatar kev avatar  avatar Rafed Ramzi avatar Eugene avatar Arda Sevinç avatar Kai Sawamoto avatar Zhao Zuohong avatar Jan Fecht avatar  avatar Adam C. Stephens avatar

Watchers

Linus Karl avatar  avatar  avatar James Cloos avatar  avatar Markus Otto avatar Michael Loipführer avatar Johannes Walcher avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.