Skip to content

Instantly share code, notes, and snippets.

@groundcat
Last active June 4, 2022 03:51
Show Gist options
  • Select an option

  • Save groundcat/244c9945750a2c3f137d62edfa4e8a53 to your computer and use it in GitHub Desktop.

Select an option

Save groundcat/244c9945750a2c3f137d62edfa4e8a53 to your computer and use it in GitHub Desktop.
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 (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
    
    
  3. Then set up the .sh file to executable with :

    chmod +x mousewheel.sh
    
    
  4. And then run script with :

    ./mousewheel.sh
    
    
  5. And set your mouse wheel speed in the popup by clicking on apply button. (my setting is 7) Re-run script for change.

  6. 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"

#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment