How do I set the mouse wheel to scroll in the same correct direction in all packages in Ubuntu 20.04?

vn flag

How do I set the mouse wheel to scroll in the same correct direction in all packages in Ubuntu 20.04?

I am running Ubuntu 20.04 LTS (codename: focal) on a desktop computer with AMD® A4-5300 apu with radeon(tm) hd graphics × 2.

I have searched for the answer to this question for the past two weeks to no avail. All the answers I have found are for those that have a touchpad. I do not have a touchpad. Therefore, my Settings do not show all the settings they say touchpad has. My Settings only shows settings for Mouse Speed and Natural Scrolling.

The most common answer is to set Natural Scrolling ON.
Open : Ubuntu Settings -re- down arrow in top right corner of screen
Select: Mouse & Touchpad
Set Natural Scrolling where is says:
Natural Scrolling: [x ] -re- (set off (no x) = grayed out)

Example: With Natural Scrolling set ON, The mouse wheel scrolls in the correct direction in Firefox and the wrong direction in Google Chrome and Chromium. With Natural Scrolling set OFF, it scrolls in the opposite direction in all three as it did when it was on.

Either way, the mouse wheel scrolls in the wrong direction in some packages and the right direction in other packages in Ubuntu 20.04.

I checked and Tweaks>Keyboard & Mouse does not have anything that refers to mouse scrolling.

I keep a history of all changes I have ever made with dconf-editor and I have never made any. My current dconf-editor does not have any mouse wheel scroll options.

Is there a setting somewhere in Ubuntu 20.04 (focal) to make the mouse wheel scroll in the same correct direction in all Ubuntu packages?

vn flag

I modified this post to get Mouse Wheel Scrolling in the same direction in all Ubuntu 20.04 packages to work for me.

Ignoring all else, this is the only thing that has to be done:

Instead of: gksu gedit run sudo gedit in the terminal to open gedit in Administrator mode. The terminal session will freeze in running mode while gedit is open.

Create a .Xmodmap file as suggested with this single line:

pointer = 1 2 3 5 4 6 7 8 9 10 11 12

Note: the id numbers 5 and 4 are inversed in the line above.

Save the .Xmodmap file to: the /home/ directory (top directory if you don't have /home/)

-re- Note: It's a dot file so it's hidden.

Close gedit to unfreeze the terminal session in running mode.

I did a full [Power off Shutdown]. Waited for a half of a minute and then a [Startup].

The direction of the Mouse Wheel Scrolling was still mixed after the [Restart].

I gave up. Worked on the computer until bedtime and did a
full [Power off Shutdown]

After [Startup] this morning, the Mouse Wheel direction is the same in all packages that I have tried. Including Firefox, Google Chrome, Chromium and most importantly for me: Atom, gthumb, Thunderbird email and the Terminal.

Moral: If the .Xmodmap file does not seem to have had an effect, do two or more complete Power off [Shutdown]s and [Startup]s before thinking it is failing to do it's job. The .Xmodmap file runs at [Startup] and it must have to make more than one change that require more than one [Startup] to take full effect.

FYI: I have a hardwired mouse as my main mouse and a wireless mouse hooked up to my desktop computer. They both work with this fix. I also checked Settings>Mouse & Touchpad>Natural Scrolling by setting it ON and OFF. Setting it ON or Off changes the scrolling direction. I have mine set to OFF. Wheels spin towards the top to get to the top. That's the way I like it. Your system may be different. Changes to Natural Scrolling are instant with no [Restart] needed.

Also: Having my Panasonic camera plugged in while doing two full [Power off Shutdown]s and [Restart]s did not mess up the Mouse Wheel Scrolling direction. But. in case something does on your system, I read in: How to disable mouse wheel scroll in ubuntu 11.04 or 10.10? that the id's for the mouse can change depending on what input devices you plugin and unplug from time to time (a camera for instance). The comment by @mattb has a fix for that. The .bashrc file is a hidden file in your user directory. I strongly suggest you make a backup of it before you make any changes in it in case something gets messed up.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.