8 releases
Uses new Rust 2024
| 0.2.0 | Dec 7, 2025 |
|---|---|
| 0.1.6 | Dec 3, 2025 |
| 0.1.5 | May 5, 2022 |
| 0.1.4 | Apr 22, 2022 |
| 0.1.3 | Mar 15, 2022 |
#92 in Unix APIs
38KB
854 lines
Ponde
Pointing device configuration daemon for Wayland and X11 using libinput and uinput.
It can do the similar configiration as xf86-input-libinput.
Motivation
In Wayland, xf86-input-libinput is not available, and the pointing device settings are different for each compositor. Gnome Wayland allows the same settings as xf86-input-libinput, but does not allow mapping of buttons, nor does it allow per-device settings.
I wrote this tool to solve these problem.
Install
$ cargo install ponde
Usage
$ sudo ponde /path/to/config.yaml
Configuration example
Example configuration is here:
devices:
- match_rule:
name: Kensington Expert Wireless TB Mouse
accel_profile: flat
scroll_button: BTN_SIDE
scroll_button_lock: true
motion_scroll_factor:
vertical: 0.5
- match_rule:
name: "- GameBall"
accel_profile: flat
scroll_button: BTN_MIDDLE
scroll_button_lock: false
- match_rule:
name: Logitech M570
accel_profile: flat
scroll_button: BTN_EXTRA
scroll_button_lock: false
button_mapping:
BTN_SIDE: BTN_MIDDLE
Configuration properties
match_rulename: Specifies device name to match.
accel_profile: Sets the pointer acceleration profile to the given profile. Permitted values areadaptive,flat. Not all devices support this option or all profiles. If a profile is unsupported, the default profile for this device is used. For a description on the profiles and their behavior, see the libinput documentation.accel_speed: Sets the pointer acceleration speed within the range [-1, 1]button_mapping: Sets the logical button mapping for this device.left_handed: Enables left-handed button orientation, i.e. swapping left and right buttons.middle_emulation: Enables middle button emulation. When enabled, pressing the left and right buttons simultaneously produces a middle mouse button click.natural_scrolling: Enables or disables natural scrolling behavior.rotation_angle: Sets the rotation angle of the device to the given angle, in degrees clockwise. The angle must be between 0 (inclusive) and 360 (exclusive).scroll_button: Designates a button as scroll button. If the button is logically down, x/y axis movement is converted into scroll events.scroll_button_lock: Enables or disables the scroll button lock. If enabled, thescroll_buttonis considered logically down after the first click and remains down until the second click of that button. If disabled (the default), thescroll_buttonis considered logically down while held down and up once physically released.wheel_scroll_factor: Sets the wheel scroll speed factor for vertical and horizontal scrolling.vertical: vertical scroll speed factor (float64, must be > 0.0).horizontal: horizontal scroll speed factor (float64, must be > 0.0).
motion_scroll_factor: Sets the motion scroll speed factor for vertical and horizontal scrolling (used withscroll_button).vertical: vertical scroll speed factor (float64, must be > 0.0).horizontal: horizontal scroll speed factor (float64, must be > 0.0).
Systemd user service
To run as a systemd user service, you need to give permission to ordinary users to manipulate /dev/uinput.
Write the following in /etc/modules-load.d/uinput.conf to explicitly load the uinput kernel module at OS boot:
uinput
Write the following udev rule in /etc/udev/rules.d/70-uinput.rules to grant permission to a login user to read/write /dev/uinput when the uinput kernel module is loaded:
KERNEL=="uinput", MODE="0660", TAG+="uaccess"
Write the following systemd user service configuration in ~/.config/systemd/user/ponde.service:
[Unit]
Description=Pointing device configuration daemon
[Service]
Type=simple
ExecStart=%h/.cargo/bin/ponde %h/.config/ponde/config.yaml
Restart=always
[Install]
WantedBy=default.target
Enable ponde.service and reboot:
% systemctl --user daemon-reload
% systemctl --user enable ponde.service
% sudo systemctl reboot
Avoid conflicts with Wayland compositor and X11 settings
The events output by ponde to uinput become input events for the Wayland compositor and X11. In other words, they are affected by these settings.
Especially affected is accel_profile, which libinput sets to adaptive by default, so if nothing is set, double acceleration will occur.
You can avoid this problem by setting the following:
For gnome:
$ gsettings set org.gnome.desktop.peripherals.mouse accel-profile flat
For hyprland:
# ~/.config/hypr/hyprland.conf
device {
name = ponde
accel_profile = flat
}
For X11:
# /etc/X11/xorg.conf.d/90-ponde.conf
Section "InputClass"
Identifier "Ponde"
MatchProduct "ponde"
Driver "libinput"
Option "AccelProfile" "flat"
EndSection
Limitation
Trackpad cannot be configured. This is intentionally disallowed because libinput converts multiple finger swipes into gesture events and the original input cannot be restored.
License
MIT
Dependencies
~8.5MB
~159K SLoC