8

Mouse wheel scrolls in reversed direction. I went into System Settings > Mouse & Touchpad > Natural Scrolling, but regardless which option I choose, it still scrolls in the incorrect for me direction.

I did some other steps, like edition .map* file in my home directory but it didn't work either.

I did restart entire laptop, so maybe something would cling in it, but no, it stays scrolling the other direction.

2

7 Answers 7

10

You have to use xinput to disable Natural Scrolling.

Open terminal:

~$ xinput list

The output should be something like:

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳         USB Keyboard                      id=10   [slave  pointer  (2)]
⎜   ↳ ImPS/2 BYD TouchPad                       id=11   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳         USB Keyboard                      id=9    [slave  keyboard (3)]
    ↳         USB Keyboard                      id=12   [slave  keyboard (3)]

Look, TouchPad id =11.

~$ xinput list-props 11

The output should be something like:

Device 'ImPS/2 BYD TouchPad':
    Device Enabled (135):   1
    Coordinate Transformation Matrix (137): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Accel Speed (274): 0.000000
    libinput Accel Speed Default (275): 0.000000
    libinput Accel Profiles Available (276):    1, 1
    libinput Accel Profile Enabled (277):   1, 0
    libinput Accel Profile Enabled Default (278):   1, 0
    libinput Natural Scrolling Enabled (271):   1
    libinput Natural Scrolling Enabled Default (272):   0
    libinput Send Events Modes Available (255): 1, 0
    libinput Send Events Mode Enabled (256):    0, 0
    libinput Send Events Mode Enabled Default (257):    0, 0
    libinput Left Handed Enabled (279): 0
    libinput Left Handed Enabled Default (280): 0
    libinput Scroll Methods Available (281):    0, 0, 1
...

Look this, libinput Natural Scrolling Enabled (271): 1.

You need to set it to 0.

xinput set-prop 11 271 0
4
  • 2
    Worked on Gnome 16.10. Unfortunately it doesn't survive a reboot and the device and property ids change. Also I have 'Enabled Default' on '0' but it turns back on anyhow.
    – robsn
    Dec 7, 2016 at 10:54
  • Add xinput set-prop 11 271 0 to .bashrc.
    – Grisotto
    Dec 8, 2016 at 14:42
  • 2
    Unfortunately this doesn't work as the id may change on reboot. Sometimes it's id 10, sometimes id 11.
    – robsn
    Dec 8, 2016 at 14:46
  • Thank you! That helps me for xubuntu20.04. But in fact there is an option for that in settings>mouse>invert direction! :o
    – Xzu
    Jan 15, 2021 at 22:30
2

This answer is largely based on the answer by grisotto which works but doesn't survive reboots on my machine.

This almost automates the process:

Get your pointer device name:

$ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ VirtualBox mouse integration              id=9    [slave  pointer  (2)]
⎜   ↳ ImExPS/2 BYD TouchPad                     id=11   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Sleep Button                              id=7    [slave  keyboard (3)]
    ↳ Video Bus                                 id=8    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]

In my case it's ImExPS/2 BYD TouchPad although it's a mouse. Next get the property id of libinput Natural Scrolling Enabled:

$ xinput list-props 11  # use the id or the name of the pointer device
Device 'ImExPS/2 BYD TouchPad':
    Device Enabled (119):   1
    Coordinate Transformation Matrix (121): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Accel Speed (271): 0.000000
    libinput Accel Speed Default (272): 0.000000
    libinput Accel Profiles Available (273):    1, 1
    libinput Accel Profile Enabled (274):   1, 0
    libinput Accel Profile Enabled Default (275):   1, 0
    libinput Natural Scrolling Enabled (261):   0
    libinput Natural Scrolling Enabled Default (262):   0
    libinput Send Events Modes Available (241): 1, 0
    [snip]

Here it's 261. Now use your pointer device name (as the id might change on reboots) and property id (stays the same) and put these lines in your ~/.bashrc. In my case it's:

device=$(xinput list --id-only 'ImExPS/2 BYD TouchPad')
xinput set-prop $device 261 0

I still have to open and close a terminal on each boot as my .bashrcis not read on boot and it doesn't work in .profile but that's just three clicks.

1
  • I added my xinput commands to ~/.xinitrc file. It gets read when you login to your xsession (from your xdm screen for example). Please check "man xinit" & find XINITRC for more info. Nov 30, 2017 at 22:31
1

In my case there was no Natural Scrolling setting, but instead a Evdev Scrolling Distance.

First: find out the device:

xinput list

As this changes upon every boot (see answer of robsn), get the id by name and store this into a var:

device=$(xinput list --id-only 'Logitech USB Laser Mouse')

Double check that you really have property Edev Scrolling Distance:

xinput list-props $device

And then set it with:

xinput set-prop $device "Edev Scrolling Distance" -1 1 1

To enable this upon every boot, add the device= and set-prop commands to your ~/.xsessionrc file.

0

disable natural scrolling. disable two finger scrolling.

1
  • Please consider adding more detail, like this, it's more a comment than an answer. How would you do such a disabling?
    – Cadoiz
    Dec 12, 2022 at 8:36
0

I used xinput to reverse the direction of wheel, too. The property of wheel direction in my pc is Evdev Scrolling Distance (272). Besides, you may need to quit nautilus and restart nautilus:

    nautilus -q
    nautilus -n

to save this change.

0

This answer is an automation of the method by robsn such that it is performed at every boot.

Get your pointer device name:

$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB Optical Mouse                id=9    [slave  pointer  (2)]
⎜   ↳ PS/2 Generic Mouse                        id=13   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=14   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ CHICONY HP Basic USB Keyboard             id=10   [slave  keyboard (3)]
    ↳ HP HD Webcam                              id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=12   [slave  keyboard (3)]
    ↳ HP Wireless hotkeys                       id=15   [slave  keyboard (3)]
    ↳ HP WMI hotkeys                            id=16   [slave  keyboard (3)]

In my case, 'Logitech USB Optical Mouse'.

Then create a natural_scrolling.sh file within your path:

#!/bin/bash

device=$(xinput list --id-only 'Logitech USB Optical Mouse'); 
xinput set-prop $device 295 1

exit 0;

(replace 'Logitech USB Optical Mouse' by your mouse name).

Add execute permission to the file. Then open startup applications, and create a new entry when the "command" line points to that file.

This automatically enables natural scrolling for me.

(Note: if you're using ubuntu-tweak, DISABLE natural scrolling there as it seems to conflict with this method - I had it enabled and it was causing some applications to scroll the other way).

0

Thanks for mentioning Natural Scroll, Ubuntu tweaks has a toggle for that, (that i pressed assuming it would make scrolling softer or something) Never would assume that function with that name.

Also for the people reading this, that want to toggle that option through GUI. You can install Ubuntu tweaks and find the option under tweaks>miscellaneous>Natural Scrolling.

This site has a .deb for Ubuntu tweaks. http://ubuntuhandbook.org/index.php/2016/05/install-ubuntu-tweak-in-ubuntu-16-04/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .