[How to] alter global mouse wheel scroll rate...

Share your own howto's etc. Not for support questions!

[How to] alter global mouse wheel scroll rate...

Postby mardybear » 2014-03-08 10:24

Researching my own mouse scroll issue i discovered a method to universally alter mouse wheel scroll rate across all applications (not just iceweasel). Not sure why there is no default mouse wheel scroll rate adjustment in linux after all these years. Hopefully a gui similar to below will become standard in most linux desktop environments in the near future. Seems crazy actually as microsoftXP's control panel had this feature in ~2001. Can't remember that far back but windows98 and 95 also likely had a similar feature.

1 Install imwheel, info: https://packages.debian.org/wheezy/imwheel
2 Activate imwheel: as root user change /etc/X11/imwheel/startup.conf IMWHEEL_START=0 to IMWHEEL_START=1
3 Reboot computer
4 Run script below (save as mousewheel.sh and mark executable, creates /home/username/.imwheelrc config file)
...or create your own /home/username/.imwheelrc config file (user defined, man imwheel and imwheel --help)
...or alter /etc/X11/imwheel/imwheelrc (global settings for all users) to setup desired scroll rate
5 Enjoy

Code: Select all
#!/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


Sample of my current /home/username/.imwheelrc config file:
Code: Select all
".*"
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


More info plus video showing install process and demo (no affiliation):
http://nicknorton.net/?q=node/10

Notes:
-As noted in the script above this works primarily with a simple/standard type mouse with left/right buttons and a middle wheel
-Always do your homework and exercise caution before making system changes
-The script can be re-run as desired to further fine tune scroll rate settings
-The imwheelrc config file can be further customized to be application specific if desired (man imwheel)
-These changes are fully reversible (remove imwheel package, delete mousewheel.sh script and all imwheelrc configuration files
-Unless your pores sweat geek, the script method is much easier than creating your own imwheelrc file :)

mardybear
800mhz, 512mb ram, dCore-jessie (Tiny Core with Debian Jessie packages) with BusyBox and Fluxbox.
Most don't have computer access, reuse or pay forward an old computer.
User avatar
mardybear
 
Posts: 994
Joined: 2014-01-19 03:30

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable