- Rust 93.6%
- C 4.3%
- Makefile 1.4%
- Shell 0.7%
| .forgejo/workflows | ||
| src | ||
| tests | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| example-libinput.toml | ||
| libinput-config-git.install | ||
| LICENSE | ||
| Makefile | ||
| PKGBUILD | ||
| README.md | ||
libinput-config-rs
This project is a fork of libinput-config which has been ported to Rust.
It can be used to tweak some Libinput configuration options that your desktop environment may not expose. This could be especially helpful if you are trying to migrate away from X11, but find there is no clear analogue to /etc/X11/xorg.conf, meaning you cannot easily configure some of the more obscure features of libinput to which you may have become accustomed.
WARNING: This is an egregious hack (see How it works). If possible, you should be using your desktop environment's own input settings, or failing that the Libinput's Lua plugin system. I cannot recommend this to anyone... But if it works for you, great!
How to build and install
Arch Linux
Simply use the provided PKGBUILD file:
makepkg -si
Other Distros
Use the provided makefile.
make build # Build the project
sudo make install # Install the shared library
sudo make enable-preload # Install the ld preload hook
To uninstall:
sudo make uninstall
For packagers
make install DESTDIR="path/to/pkgroot"
You will need to provide the necessary install script to handle ld preload hooks (similar to the libinput-config-git.install script used for the Arch package but tailored for your own distribution's packaging system).
How to use
In order for the library to work, you need to create a config file
under /etc/libinput.toml. You only need to put the options you're
going to use. For all left out options, the system defaults will be
used. If you already configured an option in your compositor, the
compositor will take the priority unless you enable
override-compositor.
The config file must be valid TOML. The following settings are implemented:
# Force libinput-config settings to apply even if your compositor has its own settings.
override-compositor = true|false
# Enable or disable tap-to-click on touchpads.
tap = true|false
# Choose how 1/2/3-finger taps map to left/right/middle click.
tap-button-map = "lrm"|"lmr"
# Enable dragging immediately after a tap gesture.
drag = true|false
# Keep drag active after you briefly lift your finger.
drag-lock = true|false
# Set libinput pointer acceleration speed.
accel-speed = <float>
# Select pointer acceleration behavior.
accel-profile = "none"|"flat"|"adaptive"
# Reverse scrolling direction for natural scrolling.
natural-scroll = true|false
# Swap left and right mouse buttons for left-handed use.
left-handed = true|false
# Select the touchpad click emulation method.
click-method = "none"|"button-areas"|"clickfinger"
# Emulate middle click by pressing left and right buttons together.
middle-emulation = true|false
# Choose which scrolling mode libinput uses.
scroll-method = "none"|"two-fingers"|"edge"|"on-button-down"
# Set which Linux input button code activates button-based scrolling.
scroll-button = <integer key code>
# Toggle whether button-based scrolling can stay latched without holding the button.
scroll-button-lock = true|false
# Disable touchpad input while typing.
dwt = true|false
# Apply a global multiplier to smooth/continuous scroll distance.
scroll-factor = <float multiplier>
# Apply an X-axis-only multiplier to smooth/continuous scrolling.
scroll-factor-x = <float multiplier>
# Apply a Y-axis-only multiplier to smooth/continuous scrolling.
scroll-factor-y = <float multiplier>
# Apply a global multiplier to discrete (wheel-step) scrolling.
discrete-scroll-factor = <float multiplier>
# Apply an X-axis-only multiplier to discrete (wheel-step) scrolling.
discrete-scroll-factor-x = <float multiplier>
# Apply a Y-axis-only multiplier to discrete (wheel-step) scrolling.
discrete-scroll-factor-y = <float multiplier>
# Apply a global multiplier to pointer movement speed.
speed = <float multiplier>
# Apply an X-axis-only multiplier to pointer movement speed.
speed-x = <float multiplier>
# Apply a Y-axis-only multiplier to pointer movement speed.
speed-y = <float multiplier>
# Apply a global multiplier to gesture movement speed.
gesture-speed = <float multiplier>
# Apply an X-axis-only multiplier to gesture movement speed.
gesture-speed-x = <float multiplier>
# Apply a Y-axis-only multiplier to gesture movement speed.
gesture-speed-y = <float multiplier>
# Define a key remapping rule (repeat this table for multiple remaps).
[[remap-key]]
# Linux input key code to remap from.
source = <integer key code>
# Linux input key code to remap to.
destination = <integer key code>
Example:
# Allow these settings to override compositor-provided values when possible.
override-compositor = true
# Enable tap-to-click.
tap = true
# Keep normal right-handed button order.
left-handed = false
# Increase smooth scroll distance by 75%.
scroll-factor = 1.75
# Remap one key code to another.
[[remap-key]]
# Remap from Linux key code 30.
source = 30
# Remap to Linux key code 48.
destination = 48
Note:
override-compositorhas no effect on the following settings. If you configure them in both your compositor and libinput-config, they'll be applied at the same time:scroll-factordiscrete-scroll-factorspeedgesture-speedremap-key
- In contrast to the touchpad
scroll-factorthat always works, the mousediscrete-scroll-factoronly works if your compositor supports high-resolution scroll wheels. scroll-buttonaccepts a key code from the Linux input event code list which is incompatible with the one used by X11.- For obvious reasons,
remap-keycan be used multiple times to remap different keys.
How it works
The library wraps around libinput and hacks into the event loop to
read the config and configure devices. Additional hackery is used to
configure scrolling sensitivity and pointer speed. To do all of this,
it uses the /etc/ld.so.preload file, which is modified by the
install script.