Reverse mouse wheel scroll direction?


#1

Is there a desktop control to change the window scrolling direction when the mouse wheel is turned? I’d like to reverse direction. Thank you.


#2

Not built-in, no.
I think you will want to look at the “xinput” utility to figure this out (the “–set-button-map” option?).
Once you determine the command to get that working on your hardware, just put it into your ~/.xprofile file and it will automatically get re-loaded every time you startup the desktop.


#3

Anyone who has successfully changed the scroll direction to ‘natural scrolling’?
I really like to have this too, for I can’t nor will get accustomed to the scrolling in the ‘wrong’ direction.
I tried the xinput utility but haven’t found useful settings. Most likely the touchpad went unuseable when I changed anything. Even the GUI ‘Mouse settings’ seams to be thought ‘not for beginners’: when I change the ‘terminal drift’ the pointer moves only every some seconds. And it is not possible to change the double-click time?
I am sure there will be great progress in future.
Any ideas for changing the scroll direction?

edit: By the way: what is meant by ‘Virtual scrolling’ (Mouse settings GUI)? This seams to change nothing.


#4

http://www.gdargaud.net/Hack/LinuxMouse.html
has some interesting things to try. The xev | grep button was interesting.

I have a logitech mouse hooked up, xinput --list showed it as device 8. 2 buttons plus a scroll wheel that also acts as a button.
left is button 1, press the scroll wheel is button 2, right button is 3, turn the wheel up is button 4, turn the wheel down is button 5. doing “xinput --set-button-map 8 1 2 3 5 4” swapped what “button” was pressed when I turn the wheel.

xinput --list-props for the mouse showed a couple of “natural scrolling enabled” properties that can also be tweaked.
man xinput in one window, play around in another.


#5

@ mer Thank you, that helped a little
I have tried the following:

[martl@tuxedo] ~% xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ sysmouse id=7 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ kbdmux id=6 [slave keyboard (3)]
[martl@tuxedo] ~% xev | grep button

CORRECT>xv | grep button (y|n|e|a)? no
xev: command not found.

[martl@tuxedo] ~% xinput list-props
Usage: xinput list-props [ …]
[martl@tuxedo] ~% xinput list-props 2
Device ‘Virtual core pointer’:
Device Enabled (133): 1
Coordinate Transformation Matrix (134): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
[martl@tuxedo] ~% xinput list-props 4
Device ‘Virtual core XTEST pointer’:
Device Enabled (133): 1
Coordinate Transformation Matrix (134): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
XTEST Device (245): 1
[martl@tuxedo] ~% xinput list-props 7
Device ‘sysmouse’:
Device Enabled (133): 1
Coordinate Transformation Matrix (134): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (247): 0
Device Accel Constant Deceleration (248): 1.000000
Device Accel Adaptive Deceleration (249): 1.000000
Device Accel Velocity Scaling (250): 10.000000
Device Node (251): "/dev/sysmouse"
Button Labels (252): “Button Left” (136), “Button Middle” (137), “Button Right” (138), “Button Wheel Up” (139), “Button Wheel Down” (140)
Mouse Middle Button Emulation (253): 1
Mouse Middle Button Timeout (254): 50

[martl@tuxedo] ~% xinput set-button-map 7 136 137 138 140 139
==> pointer moves but no action on click/doubleclick

[martl@tuxedo] ~% xinput set-button-map 7 1 2 3 4 5
==> default scroll direction
[martl@tuxedo] ~% xinput set-button-map 7 1 2 3 5 4
==> reverse/natural scrolling

OK, natural scrolling is working. Anyway confused with the button-numbers (1 … 5 and not 136 … 140)?
From the view as a user: I should not have to do such. I would really like to develop my very own OS, but there are so many other things to do …
Nevertheless very happy with TrueOS, and I am sure there will be great progress in future. :wink:


#6

The 136…140 those are the number of the individual property, not the button number. xev may not be on the system, maybe a linux thing.
As a user, there should be a wrapper of some sort around a utility that hides all this for you. As you say “so many other things to do” :slight_smile:
Now don’t forget to put the xinput command that works in your ~/.xprofile (you may need to create it) or you’ll have to do it every time you log in.


#7

FWIW, xev is a standard X program (look for xev in AppCafe). It just isn’t installed by default in TrueOS.

Regardless, thanks for tracking down the natural scrolling thing. It was one of those minor annoyances that hadn’t risen high enough for me to look at the button-map stuff.


#8

Thanks, I couldn’t recall if xev was standard X or not. It’s one of those utilities you don’t need very often, but when you do, it’s very useful.


#9

I’d like to add, there’s another way, too:

In Your HOME directory, add this pointer line:

~% cat .xsession 
#!/bin/sh

eval $(gpg-agent --daemon)

# Add this: 
eval $(xmodmap -e "pointer = 1 2 3 5 4 6 7 8 9 10")

5 and 4 are swapped. That’s the scroll wheel.


#10

How to change scroll direction within Lumina Desktop Environment:

1/2)

~% cat ${HOME}/lumina.bash
#!/usr/local/bin/bash
/usr/local/bin/xmodmap -e "pointer = 1 2 3 5 4 6 7 8 9 10"

And make it executable (chmod).

2/2)

~% cat ${HOME}/.config/autostart/lumina.bash.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=lumina.bash
Icon=unknown-bash
TryExec=/usr/home/<accountname>/lumina.bash
Exec=/usr/home/<accountname>/lumina.bash

#11

I just added this functionality into the SysAdm/moused configuration options[1].
Now there is an “Invert Scroll Wheel” option which will reverse the wheel direction on a per-device basis. This will let you invert the direction for something like a touchscreen, but still keep the normal functionality for a scroll wheel on a mouse.

[Server Update]
https://github.com/trueos/sysadm/commit/a239e43c056c49fdbc447cdfb2e94de12205306c
[Client Update]
https://github.com/trueos/sysadm-ui-qt/commit/9ee12f055c472e88f3f6d9d3c8db792a89a2f1e0


#13

Thank you for your efforts.
Just curious - does this work for anybody? For me it does not. “Invert Scroll Wheel” checked or not does not change the scroll direction with the trackpad nor with an USB-Mouse.
BTW: I would prefer “Invert Scroll Direction” for the trackpad does not have a wheel.


#14

I have two computers running STABLE-17.12. On my desktop PC the mouse settings persisted after I ran the command sudo touch /etc/conf.d/moused, as suggested by @beanpole135.

On my laptop with a synaptics touchpad I had to install xinput and add

# Reverse mouse scrolling
xinput --set-button-map 7 1 2 3 5 4

to /usr/home/username/.xprofile

The mapping might be different on your system, though.


#15

“Invert Scroll Wheel” option do not work STABLE-17.12. Laptop is HP Envy 13 d004no.