DEV Community

Cover image for Ubuntu 20.04 mouse scroll wheel speed
Bavouzet Benoît
Bavouzet Benoît

Posted on • Edited on

Ubuntu 20.04 mouse scroll wheel speed

Ubuntu 20.04 mouse scroll wheel speed


I had a very slow scroll speed until I found that.

Install and run

  1. You have to install imwhell with :

    
    
    sudo apt install imwheel
    

2. And download this bash script on [http://www.nicknorton.net](http://www.nicknorton.net/mousewheel.sh) (thanks to him)
You can type, as @victoor say in comments :
>You can just do ` bash <(curl -s http://www.nicknorton.net/mousewheel.sh) ` instead of copy the script manually and changing permissions. :) 
    ```


#!/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


Enter fullscreen mode Exit fullscreen mode
  1. Then set up the .sh file to executable with : ```

chmod +x mousewheel.sh

4. And then run script with :
    ```


./mousewheel.sh


Enter fullscreen mode Exit fullscreen mode
  1. And set your mouse wheel speed in the popup by clicking on apply button. (my setting is 7) Re-run script for change.

  2. Finally add imwheel in ubuntu startup application.

If you have troubleshooting with previous and next mouse buttons :

  • Add -b "4 5" to imwhell :


imwheel -b "4 5"


Enter fullscreen mode Exit fullscreen mode

You can found others details here for setting speed by app :

Or in the man page : man imwheel

Image : Pexels

Sorry, it's my first post.
Have a nice day !

Latest comments (63)

Collapse
 
iidelta profile image
IIDelta

Hey so I installed this, and ran it a few times, now my scroll speed is very fast with no way to slow it down again?

Collapse
 
jawad5311 profile image
Jawad Mehmood

Whenever I restart my os the mouse speed get's back to 0 automatically. Then I have to do set it again manually using the mentioned procedure. Can you help?
OS: Ubuntu 20.04.4 LTS

Collapse
 
brownd profile image
Daniel Brown

Your script doesn't work for me.

Here are my revised lines that made the script work for me (line numbers included):

29  CURRENT_VALUE=$(awk -F 'Button4,' '{print $2}' ~/.imwheelrc | grep -Eo [0-9]+)
31  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)
Enter fullscreen mode Exit fullscreen mode

FYI the changes are: added grep to return the numbers only and put an equals sign in the --text option for zenity.

Collapse
 
tancetin profile image
tancetin

Thanks.

Collapse
 
codemaoz profile image
Manuel

=D Thanks @bavouzet

Collapse
 
skogrv profile image
skogrv

Does someone know how to make these settings persistent, so it can survive reboot?

Collapse
 
bbavouzet profile image
Bavouzet Benoît • Edited

Look here wiki.archlinux.org/index.php/IMWheel
as jon sivku say
😉

Collapse
 
skogrv profile image
skogrv

thanks, did that, works like a charm

Collapse
 
deiiv profile image
Deiiv

I had an issue with this script disabling my mouses back/forward buttons. To fix, add the following to the last line of the script: imwheel -kill -b "4 5"

Collapse
 
tanveer392 profile image
Tanveer392

Why I need to fix this every time I turn on my computer?

Collapse
 
jonzivku profile image
jon zivku

Here's an article that explains how to turn this action into a startup script wiki.archlinux.org/index.php/IMWheel

Collapse
 
olivaresandres profile image
Andres Olivares

Thank's work fine in ubuntu 20.04

Collapse
 
albertzeyer profile image
Albert Zeyer

A couple of other options are listed here: askubuntu.com/questions/285689/inc...

I implemented an own simple Python script which you can simply run in the background, which implements mouse scroll wheel acceleration: github.com/albertz/mouse-scroll-wh...