Friday, February 17, 2017

How To Change The Mouse Scroll Wheel Speed In Linux Using imwheel Quick Tip

How To Change The Mouse Scroll Wheel Speed In Linux Using imwheel Quick Tip


mouse

Ive never actually needed to modify the mouse scroll wheel speed until recently, when I got a new mouse and I wanted to change the scroll wheel settings. Thats when I noticed theres no such option in Unity / GNOME Control Center.

I searched for ways to change this under Linux and the easiest to use seems to be "imwheel", a command line tool that can be used to tweak the mouse wheel behavior and which, among others, can change the scroll speed of the mouse wheel, and I decided to share the information with you.

Heres what you need to do to change the scroll speed of the mouse wheel if your desktop environment doesnt have an option for this:

1. Install imwheel. Since the app is available in the official Ubuntu repositories, you can install using Synaptic, Ubuntu Software Center, etc. or use the following command to install it:
sudo apt-get install imwheel

2. Next, create a file called ".imwheelrc" in your home directory - Ill use Gedit in the command below to open this file:
gedit ~/.imwheelrc

And in this file, paste the following:
".*"
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

"3" at the end of lines two and three represent the number of lines to scroll ("3" should be default)  - modify this number to suit your needs. Once youre done, save the file.

The first (".*") line from the code used above represents is used to specify in which applications to use those settings. ".*" means everywhere, but you can also apply application-specific settings by changing ".*" to the window name (and add multiple application-dependent settings). Run "man imwheel" for more information.

And finally, the last 4 lines in the code above are there to allow Ctrl / Shift with mouse scroll wheel up / down to work (for instance, to allow zooming in on a webpage in the web browser, etc.), which is the default behaviour.

3. Start "imwheel" (type "imwheel" in a terminal). Important note: make sure you dont run multiple imwheel instances (if you want to stop any previous instances, run the following command: "killall imwheel")!

Also, if you have back / forward navigation buttons on your mouse, they will stop working using the configuration weve used above. In such cases, you should launch imwheel like this:
imwheel -b "4 5"
... and the back / forward buttons should work (thanks to biohazara for the tip!).

4. Since these settings are only applied when imwheel is running, you should add imwheel to startup (if you use Unity, to do this, open Startup Applications, click "Add" and under both "Name" and "Command" fields, add "imwheel"). Also, like I mentioned above, if you have back / forward mouse navigation buttons, use the following command instead of simply running "imwheel" or else those buttons wont work: imwheel -b "4 5"

Its important to mention that imwheel applies the settings available in ~/.imwheelrc when the application starts and it doesnt update when changing the configuration file. So if you modify the configuration file, youll need to close imwheel and start it again to apply / test the changes (you can close/kill it using the following command: "killall imwheel").

Notes:
  • this will most probably not fix issues such as very fast scrolling, if you encounter such an issue, you can try unplugging and then plugging the mouse back (from what Ive read, that seems to solve the issue in most cases);
  • if you only want to change the scroll wheel speed in Firefox and Chrome, you can do this from within the app or using an extension: Firefox | Chrome, etc.

via AskUbuntu; image via Wikipedia.


Available link for download