Search...

Altering mouse scroll speed in Linux

I started playing with Linux, having installed Mint (Ubuntu based, which is Debian based – for more details). Linux Mint is very user friendly (unlike Linux 15 years ago), but it does have its peculiarities (especially for us coming from decades of DOS & Windows use). One of the “problems” for me was simple mouse scroll button speed change. Here’s how I fixed that.

For solving this I used Imwheel. The procedure is relatively simple and straight forward, with a few tweaks (noted in this post). It boils down to this:

If you have any questions (or additions and corrections), please use the BikeGremlin forum:
www.bikegremlin.net


1. Installing Imwheel

You can open Software Manager, search for “Imwheel”, then click “Install”, after which you will be asked to enter your root password and that’s it.

Installing Imwheel using Linux Software Manager
Installing Imwheel using Linux Software Manager
Picture 1
Authenticating the install with a root password (1), then click "Authenticate" (2)
Authenticating the install with a root password (1), then click “Authenticate” (2)
Picture 2

Of course, you could use the command prompt (CTRL+ALT+T is the keyboard shortcut, not WIN+R – note to self 🙂 ). Imwheel is installed using the following command (you will be prompted for a root password after pressing Enter):

sudo apt-get install imwheel
Command prompt installation of Imwheel
Command prompt installation of Imwheel
Picture 3

If all went well, you will see something like this:

Imwheel successfully installed
Imwheel successfully installed
Picture 4


2. Configuring Imwheel

Configuration boils down to creating a .sh file with an appropriate code, then running it. I did it the following way:

I created an “Utils” directory in my “Home” directory (that is “/home/relja/Utils”). Of course, you can put the file anywhere you want.

Then I opened a text editor, copied the needed code (found at this page – thank you) and saved it as “mouse.sh” – you can name it however you like, as long as you know the file name and directory where it’s saved at.

Needed file contents:

#!/bin/bash
# Version 0.1 Tuesday, 07 May 2013
# Comments and complaints http://www.nicknorton.net
# GUI for mouse wheel speed using imwheel in Gnome
# imwheel needs to be installed for this script to work
# sudo apt-get install imwheel
# Pretty much hard wired to only use a mouse with
# left, right and wheel in the middle.
# If you have a mouse with complications or special needs,
# use the command xev to find what your wheel does.
#
### see if imwheel config exists, if not create it ###
if [ ! -f ~/.imwheelrc ]
then

cat >~/.imwheelrc<<EOF
".*"
None,      Up,   Button4, 1
None,      Down, Button5, 1
Control_L, Up,   Control_L|Button4
Control_L, Down, Control_L|Button5
Shift_L,   Up,   Shift_L|Button4
Shift_L,   Down, Shift_L|Button5
EOF

fi
##########################################################

CURRENT_VALUE=$(awk -F 'Button4,' '{print $2}' ~/.imwheelrc)

NEW_VALUE=$(zenity --scale --window-icon=info --ok-label=Apply --title="Wheelies" --text "Mouse wheel speed:" --min-value=1 --max-value=100 --value="$CURRENT_VALUE" --step 1)

if [ "$NEW_VALUE" == "" ];
then exit 0
fi

sed -i "s/\($TARGET_KEY *Button4, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button4, and write new value.
sed -i "s/\($TARGET_KEY *Button5, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button5, and write new value.

cat ~/.imwheelrc
imwheel -kill

Update:
WordPress’s front end messes up the code, replacing two “minus signs” with a long dash. So, I’ve made a simple downloadable mouse-sh.zip file if it helps:
https://files.bikegremlin.com/downloads/mouse-sh.zip

Then, in the command prompt, go to the directory and run the file. Before running the script, you must give it the execution rights using the command “chmod +x” In my case:

cd /home/relja/Utils
chmod +x mouse.sh
./mouse.sh

Here’s how it looks like on screen, you’ll get to set mouse scroll speed:

Enter the three command lines (enter after each, of course) (1), select desired scroll speed (2), then click "Apply" (3)
Enter the three command lines (enter after each, of course) (1), select desired scroll speed (2), then click “Apply” (3)
Picture 5

I chose 3. After clicking at “Apply”, you’ll see something like this:

Successfully finished scroll speed configuration
Successfully finished scroll speed configuration
Picture 6

If you aren’t happy with the newly set mouse scroll speed, just run the “mouse.sh” again, as expained in picture 5.


Help BikeGremlin
stay online & independent

This website is educational, free, objective, and not commercial
(sponsors don’t enjoy paying if you mention all the product downsides that you notice 🙂 ).

If you find this site to be good and helpful,
and if $5 per month is what you can afford to set aside,
please consider supporting my work with a Patreon donation:


patreon.com/bikegremlin


3. Configuring Imwheel to run after each restart

For this I used “Startup Applications”.

Opening "Startup Applications"
Opening “Startup Applications”
Picture 7

On the next screen click the ” + ” sign and choose “Custom command” option.

Click the + sign and choose "Custom command"
Click the + sign and choose “Custom command”
Picture 8

The last step is shown and explained in the picture 9:

Use whatever you want for name (1) Command must say "imwheel", because that is the application (2) For comment, use whatever you like (3) Add a startup delay if you like - I set a 5 second delay (4) Finally, click "Add" (5)
Use whatever you want for name (1)
Command must say “imwheel”, because that is the application (2)
For comment, use whatever you like (3)
Add a startup delay if you like – I set a 5 second delay (4)
Finally, click “Add” (5)
Picture 9

You can try restarting the computer, to make sure mouse scroll speed is still working properly.


Troubleshooting

As Alex added in the comment section, there can be a problem with the functioning of extra mouse buttons (with some mouses that have extra buttons, in addition to the standard two and the wheel). The solution is limiting imwheel to the scroll only (wheel up: 4, and wheel down: 5). For Linux Mint, it is the following command:

imwheel -b "4 5"

“-b” is the switch that basically says “deal only with the listed buttons”. This can also be added to the command line – (2) in picture 9.

For more details (manual), type this in the command prompt:

man imwheel

If you have any questions (or additions and corrections), please use the BikeGremlin forum:
www.bikegremlin.net

The BikeGremlin forum page for comments regarding this article:
https://www.bikegremlin.net/threads/altering-mouse-scroll-speed-in-linux-article-comments.97/

59 thoughts on “Altering mouse scroll speed in Linux”

  1. No NO NO

    This is microsoft bullshit. I don’t need to install ANYTHING to adjust settings. We need to have this setting exposed. 3rd party apps just pollute the computing environment.

    • Can you propose another way of doing this, or provide a link where an alternative solution is explained in a noob-friendly way?

  2. I’d gladly pay Bill Gates 100 USD or whatever Windows 10 costs nowadays to not have to waste my time on this cryptic GNU BS. Maybe even get a Mac and practical accent input as well.

    • webupd8.org/2015/12/how-to-change-mouse-scroll-wheel-speed.html worked:

      sudo apt-get install imwheel

      gedit ~/.imwheelrc

      Paste this, save, and close gedit:

      “.*”
      None, Up, Button4, 3
      None, Down, Button5, 3
      Control_L, Up, Control_L|Button4
      Control_L, Down, Control_L|Button5
      Shift_L, Up, Shift_L|Button4
      Shift_L, Down, Shift_L|Button5

      imwheel –kill –buttons “4 5”

      Add previous command to autostarts (maybe ~/.bashrc).

    • It’s not “GNU BS” – it’s a choice. You choose and use what’s right for you – no-one is trying to take that away from you. Personally, I choose freedom, as I strongly believe the little quirks and a few “rough edges” here and there are well worth it.

      On a side-note, I have built a very successful career on Linux, so I donate back much more than $100 – every single year 🙂 Linux works for me, but it sounds like it rubs you up the wrong way.

    • “chromium” instead of “.*” to only affect Chromium and avoid turning 5 to 17 line scroll in GNOME Terminal 3.36.2.

      Linux Mint Cinnamon is my favorite OS at the moment, as i couldn’t even log into Windows 10 on a brand new HP Envy using my work email, and MacOS requires an Apple ID to update preinstalled software. Then again, Firefox caused the entire system to lag, but i’m not sure whether that also occurs on Windows as i switched to Chrome there as well and added my OOM Killer to avoid thrashing. Maybe Minix is the only truly reliable OS.

Comments are closed.


Please use the BikeGremlin.net forum for any comments or questions.

If you've found any errors or lacking information in the article(s) - please let me know by commenting on the BikeGremlin forum.
You can comment anonymously (by registering with any name/nickname), but I think it is good to publicly document all the article additions (and especially corrections) - even if their author chooses to remain anonymous.

Tools and other products that I use (and can recommend)

TOC
Skip to content