How to Change Mouse Wheel & Touchpad Scroll Speed in Ubuntu 20.04/22.04/Debian 11

Want to change the mouse wheel or touchpad two finger scroll speed in GNOME? Here’s how to do the trick in Ubuntu and Debian Linux.

GNOME desktop does not have a configure option to set scroll speed in system settings (aka gnome-control-center). Though, an issue has been created 2 years ago to request the feature in Gnome development page.

For the desktop session on Xorg, there’s a good command line tool “imwheel” can do the job. Though, there’s no good alternative for Gnome Wayland so far.

NOTE: This tutorial is tested and works on Ubuntu 20.04, Debian 11,  and Ubuntu 22.04 on Xorg (or app runs as XWayland) in my case.

Step 1. Install imwheel:

First, search and open ‘terminal’ window from Activities overview screen.

When terminal opens, run command to install imwheel package:

sudo apt install imwheel
Tip: The package is also available in Fedora, openSUSE, Arch Linux repositories.
Install imwheel on Ubuntu/Debian based systems

Step 2. Create config file:

After installed the tool, run command to create a configuration file:

gedit ~/.imwheelrc

For Ubuntu 22.10+, replace gedit with gnome-text-editor, or use nano that works in most Linux.

The command will create and open the ‘.imwheelrc‘ file via gedit text editor. When it opens, paste following lines:

# Speed up scrolling and pass unchanged for zoom and side buttons
".*"
None, Up, Button4, 4
None, Down, Button5, 4
Shift_L, Up, Shift_L|Button4, 4
Shift_L, Down, Shift_L|Button5, 4
Control_L, Up, Control_L|Button4
Control_L, Down, Control_L|Button5
None, Thumb1, Alt_L|Left
None, Thumb2, Alt_L|Right

Here are descriptions for each lines:

  • The first line started with # is comment that does not function.
  • The “.*” tell to function for all apps. User may use something else, such as “^chromium$” to make it for chromium only.
  • The 3th and 4th lines started with “None”, set the scroll speed to 4. Change the number as you mind to increase or decrease the speed.
  • And, the next 4 lines configure the left Shift+ and Ctrl+ mouse scroll speed. In the case, “Ctrl+scroll” is left unchanged.
  • The last 2 lines tell the side buttons unchanged. Use may skip them if NO side buttons present.
scroll speed settings

Step 3. Verify:

After installed imwheel and setup the config file, now run imwheel command in terminal:

imwheel

Then open a web page and scroll either via mouse wheel or touchpad 2 finger gesture. If it works, go continue Step 4.

If NOT working properly, kill the process and re-configure the ‘.imwheelrc’ file via the previous step.

sudo kill -9 PID
NOTE: Running imwheel command will tell you the PID (Process ID) in terminal output.
Or run ps ax |grep imwheel to find it.

Step 4. Make ‘imwheel’ runs automatically on startup:

If everything is working OK, you may now make the tool starts automatically on startup. And, here’s how to do the trick by creating a user service.

  • Firstly, open terminal and run command to create “.config/systemd” folder:
    mkdir ~/.config/systemd
  • Next, create a user subdirectory. It will output warnings if folder already exist. Just skip them.
    mkdir ~/.config/systemd/user
  • Now, run command to create a service file under that directory and edit via gedit text editor:
    gedit ~/.config/systemd/user/imwheel.service

When file opens, paste following lines for the service will start with 30 seconds delay.

[Unit]
Description=IMWheel
Wants=display-manager.service
After=display-manager.service

[Service]
Type=simple
ExecStartPre=-/bin/sleep 30
Environment=XAUTHORITY=%h/.Xauthority
ExecStart=/usr/bin/imwheel -d
ExecStop=/usr/bin/pkill imwheel
RemainAfterExit=yes

[Install]
WantedBy=graphical-session.target

Finally, enable this service via command:

systemctl --user --now enable imwheel.service

In next boot, user may check the “imwheel” status via command:

systemctl --user status imwheel.service

It should outputs ‘active (running)‘ in green indicates the service starts properly! Note: there are 30 seconds delay, so check it a moment later after login.

How to Restore:

For any reason, there are options to uninstall imwheel and restore the scroll speed. Firstly, open terminal by searching from ‘Activities‘ overview. Then, run following commands one by one:

  • Disable the imwheel service:
    systemctl --user --now disable imwheel.service
  • Remove the service file:
    rm ~/.config/systemd/user/imwheel.service
  • Uninstall imwheel via command:
    sudo apt remove imwheel
  • And, clear the configuration file via command:
    rm ~/.imwheelrc

That’s all. Enjoy!

Exit mobile version