Mouse wheel scrolls in reversed direction

17,572

Solution 1

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

Solution 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.

Solution 3

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.

Share:
17,572

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    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.

    • Admin
      Admin over 8 years
      Ubuntu's "Natural Scrolling" setting seems, for now, to only reliably affect touchpad behavior. To get "Natural Scrolling" applied to the mouse wheel (or to remove this setting if someone previously applied it to your laptop), I refer you to this related question, particularly the answer provided by D. Charles Pyle.
  • robsn
    robsn over 7 years
    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.
  • Grisotto
    Grisotto over 7 years
    Add xinput set-prop 11 271 0 to .bashrc.
  • robsn
    robsn over 7 years
    Unfortunately this doesn't work as the id may change on reboot. Sometimes it's id 10, sometimes id 11.
  • AlbusMPiroglu
    AlbusMPiroglu over 6 years
    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.
  • Xzu
    Xzu over 3 years
    Thank you! That helps me for xubuntu20.04. But in fact there is an option for that in settings>mouse>invert direction! :o