How to scroll the screen using the middle click?

The feature you are talking about is called "Auto-Scrolling". It lets you press and hold the middle mouse button and move your mouse to scroll smoothly. In Linux, the default behavior for this action (pressing middle mouse button) is generally pasting text.

However, there is a preference setting in Firefox and an extension available for Chrome/Chromium which would let you use the middle mouse button for scrolling and activate this feature.

Firefox

  • Open the "Options" tab: "≡" (Open menu) → "Options".

  • Navigate to "General" (it should open to "General" by default).

  • Scroll down to "Browsing".  Under "Browsing", you will find the "Use autoscrolling" option. Put a check mark beside this to activate this functionality in Firefox.

    Or just search for "autoscrolling" using the search bar.

Firefox Preferences tab with autoscrolling highlighted

    In older versions of Firefox: "Edit" → "Preferences" → "Advanced" → "General" → "Browsing" → "User autoscrolling".  Click on the below for a larger image.

        User autoscrolling option in older versions of Firefox

Chrome/Chromium

For Chrome/Chromium we can use an Extension called "AutoScroll" (from kaescripts.blogspot.com).

  • Go to this link on Chrome Web Store (obviously using Chrome/Chromium).

  • Click on the button labeled "+ ADD TO CHROME" to install this extension.

    Chrome Extension

  • Click on "Add" in the Confirmation Dialog Box.

Other Applications

As far as other applications are concerned, I haven't yet found a solution for them. Anyways, it's the tall webpages that create most of the problems for which both Firefox and Chrome/Chromium have a solution.


This will work with all your applications without the need of installing anything.

Get your input deviceID. In my case was 11.

xinput list

If you want, list available properties with xinput list-props <deviceID>. If you are using libinput (the future/present), almost all properties will start with libinput. For evdev check my answer here.

With libinput

Set mouse properties

xinput set-prop 11 "libinput Scroll Method Enabled" 0, 0, 1  # This is button
xinput set-prop 11 "libinput Button Scrolling Button" 2      # This is middle mouse. Already 2 by default

Description from man libinput:

  • libinput Scroll Method Enabled 3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button". Indicates which scroll method is currently enabled n this device.
  • libinput Button Scrolling Button 1 32-bit value. Sets the button number to use for button scrolling. This setting is independent of the scroll method, to nable button scrolling the method must be set to button-scrolling and a valid button must be set.

  • You can add this to a bash script and run it at login.
  • Like mouse wheel, with the same movement while pressing Ctrl will zoom in/out page. Ctrl + 0 to reset.
  • This work with X and probably with Wayland.

TRY THIS : For auto scroll functionality in firefox

firefox > preferences > search auto scroll and enable it

in firefox which comes with vanilla ubuntu its disabled sometimes if you want to further tweak your mouse settings as in the control panel below you might want to install gnome-tweak-tool

sudo apt-get install gnome-tweak-tool enter image description here

SECOND ALTERNATIVE :

  • change the middle mouse button behaviour through xinput.
  • type the below code to probe input devices and peripherals

xinput list

  • and you should get similar display as below: enter image description here
  • now my mouse is 9
  • now write this in terminal

xinput set-prop 9 "libinput Scroll Method Enabled" 0, 0, 1

  • now check the behaviour of mouse when you press the middle key and move up or down in any application with vertical scroll [big text /document].