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 codes, which is shown below.
".*" None, Up, Button4, 2 None, Down, Button5, 2 Control_L, Up, Control_L|Button4 Control_L, Down, Control_L|Button5 Shift_L, Up, Shift_L|Button4 Shift_L, Down, Shift_L|Button5
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” represents speed. I recommend 2. You can change it as you wish.
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, open a program. I recommend VS Code. To test Ctrl + Scroll_Up, I recommend websites in Chrome.
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.