Skip to content

About

A tuned version of libinput (touchpad input library used by most Linux desktops) to get rid of some annoyances.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

libinput-tuned

A patched libinput that removes two touchpad differences people notice when they switch from Windows to Linux. The goal is to make the touchpad feel like the one you're used to: no more accidental clicks in context menus, and right click in the bottom-right corner works again.

Both changes are small, touch only the touchpad code, and keep all of libinput's timings and defaults.

What it changes

1. A two-finger tap is always a complete click. With stock libinput, opening a context menu with a two-finger tap and then moving to an entry at normal speed can click that entry without you clicking, for example pasting accidentally. After a two-finger tap, libinput keeps the right button held for about 200 ms so the tap can turn into a drag; if your finger touches the pad again in that time, the button is released over the menu entry and the menu takes it as a click. Two- and three-finger taps now send the full click at once, like on Windows. One-finger tap-and-drag still works.

2. The bottom-right corner is a right click, also with "two-finger click" enabled. libinput makes you choose between two fingers anywhere and the bottom-right corner for right clicks; Windows does both. With two-finger click enabled, a one-finger press in the bottom-right corner (bottom 10 mm, right half) is now a right click too.

Which desktops does it work with?

Every desktop that uses libinput, so practically all current ones: KDE Plasma, GNOME (Fedora, Ubuntu, ...), Cinnamon, Xfce on Wayland, Sway, Hyprland and others, on Wayland and on X11 (through xf86-input-libinput). Nothing is KDE-specific.

It needs these touchpad settings (names vary slightly per desktop):

Setting KDE Plasma (System Settings → Touchpad) GNOME (Settings → Mouse & Touchpad)
Tap to click: on (for fix 1) Tapping: Tap-to-click Tap to Click
Right click with two fingers (for fix 2) Right-click: Press anywhere with two fingers Secondary Click: Two Finger Push

Install

Works on Arch Linux and derivatives (CachyOS, EndeavourOS, Manjaro, ...) and Fedora:

curl -fsSLO https://raw.githubusercontent.com/cgiangreco/libinput-tuned/main/install.sh
bash install.sh

Then log out and back in. Run it as your normal user; it asks for sudo when needed.

  • Arch: installs the packages from the latest release (bash install.sh --build builds them on your machine instead). They replace libinput and libinput-tools.
  • Fedora: rebuilds Fedora's own libinput package with the patches (takes a few minutes).

To go back to the stock libinput: bash install.sh --uninstall.

Updates

New libinput versions are picked up automatically: a daily GitHub Action builds each new release with the patches, publishes it here, and opens an issue if a patch needs adjusting.

  • Release packages / install.sh on Arch: a normal system update keeps libinput-tuned (it replaces libinput), but doesn't update it; run install.sh again for a new version.
  • Fedora: a Fedora update of libinput replaces the patched version. Keep it with sudo dnf versionlock add libinput (on older Fedora install python3-dnf-plugin-versionlock first) and run install.sh again when you want to update.

Other distributions

The patches are written against libinput 1.32.0 and only touch src/evdev-mt-touchpad-tap.c and src/evdev-mt-touchpad-buttons.c. Apply them to your distribution's libinput source package and rebuild it. Skip the test suite (--nocheck or similar): libinput's tests check two-finger tap-and-drag, which the first patch removes on purpose.

Disclaimer

This replaces a core system component (libinput, the input library your desktop uses) with a patched build. It's tested on my own machines, but use it at your own risk: I'm not responsible for any problems it causes. If something goes wrong, bash install.sh --uninstall (or your package manager) brings back the stock libinput; if the touchpad stops working, a USB mouse or the keyboard still let you do that.

Upstream

These behaviours are reported in several places, for example Launchpad #1990287 (extra click after two-finger tap + drag over a context menu), KDE #472215 (separate settings for one- and two-finger tap-and-drag), KDE #460102 and KDE #468231 (right click with both two fingers and the corner). Desktops can only offer settings that libinput provides, so the proper fix is in libinput itself. Both changes are proposed upstream as opt-in settings:

  • libinput #1380: option to disable tap-and-drag for multi-finger taps
  • libinput #1381: clickfinger plus right click in the bottom-right corner

License

The patches are under libinput's MIT license. The PKGBUILD is based on the Arch Linux libinput package (0BSD).

About

A tuned version of libinput (touchpad input library used by most Linux desktops) to get rid of some annoyances.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages