Recently, I noticed a strange bug: sometimes mouse wheel scrolling is not working on Linux. Some interfaces are even worse, it 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 system-wide wheel scrolling speed. Unfortunately, most of Linux desktop environment doesn’t have any settings to adjust 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, the rear part is the key.
Code line 2 and 3:
Mouse scroll buttons are button 4 and button 5 by default. If you are not sure or want to figure out, try use xev command in Terminal.
# input this command directly in shell xev
And you will test mouse scroll buttons like this:
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 line 4 and 5:
This is to let the composition “Ctrl + Scroll_Up” work.
Code line 6 and 7:
This is to let the composition “Shift + Scroll_Up” work.
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 system menu, click the “+” at the bottom, choose “add new command”, then input the code.