Recently, I noticed a strange bug: sometimes mouse wheel scrolling is not working on Linux. Some interfaces are even worse, they can’t scroll at all. But if scrolling slowly, it would work, just still tend to be stuck.
I tried many solutions, and finally, I decided to change the system-wide wheel scrolling speed. Unfortunately, most Linux desktop environment doesn’t have any settings to adjust the mouse wheel scrolling speed. So we need a tinny tool to solve the problem. That is imwheel.
*** This solution is tested fine on Debian 11. ***
First, we need to install imwheel.
apt install imwheel
Then we need to create a config file whose path is /home/username/.imwheelrc
# change "username" by yourself nano /home/username/.imwheelrc
In the config file, we need to write code, which is shown below.
".*" 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
If the config file can’t be written out, try to edit under root (sudo).
EXPLAIN the code:
For each line, the fore part is the operation, and the rear part is the key.
Code lines 2 and 3:
Mouse scroll buttons are button 4 and button 5 by default. If you are not sure or want to figure it out, try using xev command in Terminal.
# input this command directly in shell xev
And you will test mouse scroll buttons like this:
So if your mouse has extra buttons and you want them to work, you need to test by yourself.
The number following “button 4” and “button 5” represents scrolling speed. I recommend 3. You can change it as you wish (smaller is faster).
Code lines 4 and 5:
This is to let the combination “Ctrl + Scroll_Up” work.
Code lines 6 and 7:
This is to let the combination “Shift + Scroll_Up” work.
And also, if you want to make more combinations, you need to edit the config file by yourself. See more in the documentation.
Now we need a command to run imwheel.
# this command is both for start and restart imwheel -kill
To see the effect, launch a program. I recommend VS Code. To test Ctrl + Scroll_Up, I recommend browsing websites in Chrome or Firefox.
If you are sure the solution is fine, the last thing is to start imwheel while booting the system.
Open Startup Applications from the system menu, click the “+” at the bottom, choose “add new command”, then input the code.