Difference between revisions of "Libinput"

From ArchWiki
Jump to navigation Jump to search
(→‎Common options: ClickMethod=fingers)
m (click method now is named "clickfinger")
Line 81: Line 81:
To configure the device of your choice specify a filter by using {{ic|MatchIsPointer "on"}}, {{ic|MatchIsKeyboard "on"}}, {{ic|MatchIsTouchpad "on"}} or {{ic|MatchIsTouchscreen "on"}} and add your desired option. Common options include:
To configure the device of your choice specify a filter by using {{ic|MatchIsPointer "on"}}, {{ic|MatchIsKeyboard "on"}}, {{ic|MatchIsTouchpad "on"}} or {{ic|MatchIsTouchscreen "on"}} and add your desired option. Common options include:
* {{ic|"Tapping" "on"}}: tapping a.k.a. tap-to-click
* {{ic|"Tapping" "on"}}: tapping a.k.a. tap-to-click
* {{ic|"ClickMethod" "fingers"}}: trackpad no longer has middle and right button areas and instead two-finger click is a context click and three-finger click is a middle click, see the [https://wayland.freedesktop.org/libinput/doc/latest/clickpad_softbuttons.html#clickfinger docs].
* {{ic|"ClickMethod" "clickfinger"}}: trackpad no longer has middle and right button areas and instead two-finger click is a context click and three-finger click is a middle click, see the [https://wayland.freedesktop.org/libinput/doc/latest/clickpad_softbuttons.html#clickfinger docs].
* {{ic|"NaturalScrolling" "true"}}: natural (reverse) scrolling
* {{ic|"NaturalScrolling" "true"}}: natural (reverse) scrolling
* {{ic|"ScrollMethod" "edge"}}: edge (vertical) scrolling
* {{ic|"ScrollMethod" "edge"}}: edge (vertical) scrolling

Revision as of 05:46, 20 December 2016

From the libinput wiki page:

libinput is a library to handle input devices in Wayland compositors and to provide a generic X.Org input driver. It provides device detection, device handling, input device event processing and abstraction so minimize the amount of custom input code compositors need to provide the common set of functionality that users expect.

The X.Org input driver supports most regular Xorg#Input devices. Particularly notable is the project's goal to provide advanced support for touch (multitouch and gesture) features of touchpads and touchscreens. See the project documentation for more information.


If you wish to use libinput under Wayland, there is nothing to do for installation. The libinput package should already be installed as a dependency of any graphical environment you use that has Wayland, and no additional driver is needed.

If you wish to use libinput with Xorg, install the xf86-input-libinput package, which is "a thin wrapper around libinput and allows for libinput to be used for input devices in X. This driver can be used as as drop-in replacement for evdev and synaptics." [1] In other words, other packages used for input with X (i.e., those prefixed with xf86-input-) can be replaced with this driver.

You may also want to install xorg-xinput to be able to change settings at runtime.


For Xorg, a default configuration file is installed in /usr/share/X11/xorg.conf.d/40-libinput.conf. No extra configuration is necessary for it to autodetect keyboards, touchpads, trackpointers and supported touchscreens.

First, execute:

# libinput-list-devices 

It will output the devices on the system and their respective features supported by libinput.

After a restart of the graphical environment, the devices should be managed by libinput with default configuration, if no other drivers are configured to take precedence.

See the libinput(4) manual page for general options to set. The xinput tool is used to view or change options available for a particular device at runtime. For example:

$ xinput list

to view all devices and determine their numbers

$ xinput list-props device-number 

to view and

$ xinput set-prop device-number option-number setting 

to change a setting.

See Xorg#Using .conf files for permanent option settings. Logitech Marble Mouse#Using libinput and #Button re-mapping illustrate examples.

Alternative drivers for Xorg#Input devices can generally be installed in parallel. If you intend to switch driver for a device to use libinput, ensure no legacy configuration files /etc/X11/xorg.conf.d/ for other drivers take precedence.

Tip: If you have libinput and synaptics installed in parallel with default configuration (i.e. no files in /etc/X11/xorg.conf.d for both), synaptics will take precedence due to its 70-synaptics.conf file name. To avoid this, you can symlink the default libinput configuration:
# ln -s /usr/share/X11/xorg.conf.d/60-libinput.conf /etc/X11/xorg.conf.d/60-libinput.conf
If you do have /etc/X11/xorg.conf.d/ configuration files for both, the libinput file must be ordered second; see Xorg#Using .conf files.

One way to check which devices are managed by libinput is the xorg logfile. For example, the following:

$ grep -e "Using input driver 'libinput'" /path/to/Xorg.0.log
[    28.799] (II) Using input driver 'libinput' for 'Power Button'
[    28.847] (II) Using input driver 'libinput' for 'Video Bus'
[    28.853] (II) Using input driver 'libinput' for 'Power Button'
[    28.860] (II) Using input driver 'libinput' for 'Sleep Button'
[    28.872] (II) Using input driver 'libinput' for 'AT Translated Set 2 keyboard'
[    28.878] (II) Using input driver 'libinput' for 'SynPS/2 Synaptics TouchPad'
[    28.886] (II) Using input driver 'libinput' for 'TPPS/2 IBM TrackPoint'
[    28.895] (II) Using input driver 'libinput' for 'ThinkPad Extra Buttons'

is a notebok without any configuration files in /etc/X11/xorg.conf.d/, i.e. devices are autodetected.

Of course you can elect to use an alternative driver for one device and libinput for others. A number of factors may influence which driver to use. For example, in comparison to Touchpad Synaptics the libinput driver has fewer options to customize touchpad behaviour to one's own taste, but far more programmatic logic to process multitouch events (e.g. palm detection as well). Hence, it makes sense to try the alternative, if you are experiencing problems on your hardware with one driver or the other.

Common options

Custom configuration files should be placed in /etc/X11/xorg.conf.d/ and following a widely used naming schema 30-touchpad.conf is often chosen as filename.

Tip: Have a look at /usr/share/X11/xorg.conf.d/60-libinput.conf for guidance and refer to the libinput(4) manual page for a detailed description of available configuration options.

A basic configuration should have the following structure:

Section "InputClass"
    Identifier "devname"
    Driver "libinput"
    Option "Device"   "devpath"

You may define as many sections as you like in a single configuration file. To configure the device of your choice specify a filter by using MatchIsPointer "on", MatchIsKeyboard "on", MatchIsTouchpad "on" or MatchIsTouchscreen "on" and add your desired option. Common options include:

  • "Tapping" "on": tapping a.k.a. tap-to-click
  • "ClickMethod" "clickfinger": trackpad no longer has middle and right button areas and instead two-finger click is a context click and three-finger click is a middle click, see the docs.
  • "NaturalScrolling" "true": natural (reverse) scrolling
  • "ScrollMethod" "edge": edge (vertical) scrolling

Bear in mind that some of them may only apply to certain devices.

Graphical tools

There are different GUI tools:

Tips and tricks

Button re-mapping

Swapping two- and three-finger tap for a touchpad is a straight forward example. Instead of the default three-finger tap for pasting you can configure two-finger tap pasting by setting the TappingButtonMap option in your Xorg configuration file. To set 1/2/3-finger taps to left/right/middle set TappingButtonMap to lrm, for left/middle/right set it to lmr.

Section "InputClass"
    Identifier "touchpad"
    Driver "libinput"
    MatchIsTouchpad "on"
    Option "Tapping" "on"
    Option "TappingButtonMap" "lmr"

Remember to remove MatchIsTouchpad "on" if your device is not a touchpad and adjust the Identifier accordingly.

Manual button re-mapping

For some devices it is desirable to change the button mapping. A common example is the use of a thumb button instead of the middle button (used in X11 for pasting) on mice where the middle button is part of the mouse wheel. You can query the current button mapping via:

$ xinput get-button-map device

You can freely permutate the button numbers and write them back. Example:

$ xinput set-button-map device 1 6 3 4 5 0 7

In this example, we mapped button 6 to be the middle button and disabled the original middle button by assigning it to button 0. This may also be used for Wayland, but be aware both the device number and its button-map will be different. Hence, settings are not directly interchangeable.

Tip: You can use xev (from the xorg-xev package) to find out which physical button is currently mapped to which ID.

Some devices occur several times under the same device name, with a different amount of buttons exposed. The following is an example for reliably changing the button mapping for a Logitech Revolution MX mouse via xinitrc:

for i in $(xinput list | grep "Logitech USB Receiver" | perl -n -e'/id=(\d+)/ && print "$1\n"')
	do if xinput get-button-map "$i" 2>/dev/null| grep -q 20; then
		xinput set-button-map "$i" 1 17 3 4 5 8 7 6 9 10 11 12 13 14 15 16 2 18 19 20


While the libinput driver already contains logic to process advanced multitouch events like swipe and pinch gestures, the Desktop environment or Window manager might not have implemented actions for all of them yet.

For EWMH (see also wm-spec) compliant window managers, the libinput-gestures utility can be used meanwhile. The program reads libinput gestures (through libinput-debug-events) from the touchpad and maps them to gestures according to a configuration file. Hence, it offers some flexibility within the boundaries of libinput's built-in recognition.

To use libinput-gestures, install the libinput-gesturesAUR package. You can use the default system-wide configured swipe and pinch gestures or define your own in a personal configuration file, see the README for details.


First, see whether the packaged libinput-debug-events tool can support you in debugging the problem. Executing libinput-debug-events --help shows options it covers.

Some inputs require kernel support. The tool evemu-describe from the evemu package can be used to check:

Compare the output of software supported input trackpad driver with a supported trackpad. i.e. a couple of ABS_ axes, a couple of ABS_MT axes and no REL_X/Y axis. For a clickpad the INPUT_PROP_BUTTONPAD property should also be set, if it is supported.

Touchpad not working in GNOME

Ensure the touchpad events are being sent to the GNOME desktop by running the following command:

$ gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled

See also