Linux – IMWheel creates jittery scroll when using touch-pad

linux-mintmousescrollingtouchpad

Mouse scroll performance is poor in Linux and there is no built-in method to control the same. Hence, I did some digging and came across IMWheel. I followed this tutorial How to Adjust or Increase Mouse Scroll Wheel Speed in Linux and set my mouse scroll speed to 5.

This seemed to fix my physical mouse scroll speed. However, scrolling using the touchpad of my laptop is anything but perfect. The page seems to behave erratically and jumps every time a certain amount of page is scrolled and is very unpleasant. On disabling IMWheel, the touchpad behavior seems to return back to normal.

Is there any method to have a decent scroll speed for physical mouse and yet keep the existing scrolling experience for the touchpad in Linux? Like it is there in Windows? If there is, please guide me on how to fix this issue.

This problem literally keeps me from using Linux at all!

Given below are my current mouse and touchpad settings:

Current Mouse settings:
Current Mouse Settings

Current Touchpad settings:
Current Touchpad Settings

Hardware and Software Details:

  • OS: Linux Mint Cinnamon 19.1
  • Laptop: HP AB032TX (Dual Boot: Windows 10 & Linux Mint)
  • Software in question: IMWheel
  • Touchpad Driver: Synaptics (Default drivers that came with Mint)
  • Physical Mouse: Logitech normal optical mouse

Best Answer

We can do the following to start imwheel when the mouse is plugged in, and stopped when the mouse is unplugged.

I'm on Fedora 33, but a similar solution should work on other distributions.

This method is assuming you have an imwheel service running on your machine.

$HOME/xinputwatcher.sh (remember to chmod +x this file)

#!/bin/bash
while true
do
  if [[ $(xinput list --name-only | grep 'Logitech USB-PS/2 Optical Mouse') ]];
  then
    if [[ $(systemctl --user is-active imwheel) == inactive ]];
    then
      systemctl --user start --now imwheel
      echo "starting imwheel"
    else
      echo "imwheel already running"
    fi
  else
    if [[ $(systemctl --user is-active imwheel) == active ]];
    then
      systemctl --user stop --now imwheel
      echo "stopping imwheel"
    else
      echo "imwheel already stopped"
    fi
  fi
  sleep 3
done
  • Note, you should replace 'Logical .. Mouse' string with whatever your mouse name is (type xinput to get the list of devices).
  • If you have multiple mice, then you want to add an elseif block.
  • Note the sleep command; if we unplug the mouse it should take effect within 3 seconds.
  • Go ahead and test this script by running ./xinputwatcher.sh. It should start imwheel when you plug in your mouse in, and stop imwheel when you unplug it.

Now create the service that runs that script automatically at system start.

$HOME/.config/systemd/user/xinputwatcher.service

[Unit]
Description=xinputwatcher

[Service]
Type=simple
ExecStart=$HOME/xinputwatcher.sh
KillMode=process

[Install]
WantedBy=graphical-session.target

Finally, enable the service so it starts automatically on reboot.

systemctl --user daemon-reload
systemctl --user enable xinputwatcher.sh
Related Question