Enable Natural Scrolling for Trackpads Using libinput


Last updated on October 28, 2018

Libinput is a library to handle input devices in Wayland and X.Org. It can be used as a drop-in replacement for evdev and synaptics in X.Org, and it is supported by a wide range of desktop environments, including GNOME and Xfce. In this post, we will see how to enable natural scrolling for trackpads using libinput. We will also leave mouses alone, i.e., no natural scrolling for mouses.

First, we need to know the name of the trackpad to enable natural scrolling for. This can be easily known by executing xinput --list. My output includes the following:

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ bcm5974                                   id=13   [slave  pointer  (2)]

It is easy to see that my trackpad is bcm5974.

Then, we need to know whether libinput is in charge of the trackpad. This can be done by executing xinput --list-props bcm5974 (replace bcm5974 with your device) and looking for the prefix libinput there. In my case, the output includes the following:

Device 'bcm5974':
        Device Enabled (145):   1
        Coordinate Transformation Matrix (147): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        libinput Tapping Enabled (340): 0
        libinput Tapping Enabled Default (341): 0
        libinput Tapping Drag Enabled (342):    1
        libinput Tapping Drag Enabled Default (343):    1
        libinput Tapping Drag Lock Enabled (344):       0
        libinput Tapping Drag Lock Enabled Default (345):       0
        libinput Tapping Button Mapping Enabled (346):  1, 0
        libinput Tapping Button Mapping Default (347):  1, 0
        libinput Accel Speed (348):     0.000000
        libinput Accel Speed Default (349):     0.000000
        libinput Natural Scrolling Enabled (350):       1
        libinput Natural Scrolling Enabled Default (351):       0
        libinput Send Events Modes Available (265):     1, 1
        libinput Send Events Mode Enabled (266):        0, 0
        libinput Send Events Mode Enabled Default (267):        0, 0
        libinput Left Handed Enabled (352):     0
        libinput Left Handed Enabled Default (353):     0
        libinput Scroll Methods Available (354):        1, 1, 0
        libinput Scroll Method Enabled (355):   1, 0, 0
        libinput Scroll Method Enabled Default (356):   1, 0, 0
        libinput Click Methods Available (357): 1, 1
        libinput Click Method Enabled (358):    0, 1
        libinput Click Method Enabled Default (359):    0, 1
        libinput Middle Emulation Enabled (360):        0
        libinput Middle Emulation Enabled Default (361):        0
        libinput Disable While Typing Enabled (362):    1
        libinput Disable While Typing Enabled Default (363):    1
        Device Node (268):      "/dev/input/event13"
        Device Product ID (269):        1452, 610
        libinput Drag Lock Buttons (364):       
        libinput Horizontal Scroll Enabled (365):       1

That means libinput is in charge of my trackpad.

READ ALSO  Can You Market With Text and Twitter as a Tool?

Now we can enable natural scrolling for this trackpad. To do this manually, use the following command (remember to replace bcm5974 with your device name):

xinput --set-prop bcm5974 "libinput Natural Scrolling Enabled" 1

We can always add this into ~/.xsessionrc to make it automatically take effect upon logging in.



Source link

?
WP Twitter Auto Publish Powered By : XYZScripts.com