43

On Windows, most programs with large, scrollable text containers (e.g. all browsers, most word processors and IDEs) let you press the middle mouse button and then move the mouse to scroll. This scrolling is smooth and allows you to scroll very quickly using just the mouse.

When I've used Linux on laptops, two-finger scrolling performs roughly the same function; it's easy to scroll down a page quickly (much more quickly than one can by scrolling a mouse wheel) but the scrolling remains smooth enough to allow precise positioning.

I am unsure how to achieve the same thing when running Linux on a Desktop with a mouse. As far as I can tell after a whole bunch of Googling, there are neither application-specific settings to swap to Windows-style middle mouse button behaviour, nor any system-wide settings to achieve the same effect.

Just to make this concrete, let's say - if it's relevant - that I'm asking in the context of Firefox, Google Chrome, Gedit and Eclipse on a recent version of either Mint (what I use at home) or Ubuntu (what I use at work). I suspect this is a fairly distro-agnostic and application-agnostic question, though.

As far as I can tell, my options for scrolling are:

  • Scroll with the mousewheel - slow!
  • Use the PgUp / PgDn keys - jumps a huge distance at a time so can't be used for precise positioning, and is less comfortable than using the mouse
  • Drag the scroll bar at the right hand side of the screen up and down like I used to do on old Windows PCs with two-button mice. This is what I do in practice, but it's just plain less comfortable than Windows-style middle-mouse scrolling; on a huge widescreen, it takes me most of a second just to move the cursor over from the middle of the screen to the scrollbar, and most of a second to move it back again, and I have to take my eyes off the content I'm actually scrolling to do this.

None of these satisfy me! This UI issue is the single thing that poisons my enjoyment of Linux on desktops and almost makes me wish I was using a laptop touchpad instead of a mouse. It irritates me enough that I've concluded that either I'm missing some basic Linux UI feature that solves this problem, or I'm just an oversensitive freak and it doesn't even bother anyone else - but I'm not sure which.

So my questions are:

  1. Does Windows-style middle mouse button scrolling exist anywhere in the Linux world, or is it really purely a Windows thing? In particular, do any Linux web browsers let you use Windows-style scrolling?
  2. Are there any mechanisms for scrolling pages that exist in Linux but not in Windows, especially ones that perform the role I've described?
  3. Any other solutions that I'm missing?
5
  • 1
    You call "holding down middle mouse and moving the mouse" "Windows-style" scrolling but I was never aware that there was anything Windows-specific about it. I actually had no idea what you meant by "Windows-style" before I read through your question carefully. You may want to edit your question to use a more enlightening term as I doubt many other people on this site will know what you mean. As far as I can remember that was fairly standard behavior even on Linux - it's probably just a matter of mouse configuration and whether holding down the mouse wheel registers as middle mouse button. – jw013 Dec 19 '12 at 16:04
  • 1
    @jw013 I've never seen a Linux install where this behavior existed; middle mouse button always seems to just be Paste, and Googling suggests there's no way to turn off the middle-mouse paste behavior (which implies to me no way to turn on middle-mouse scroll behavior - but I'm not sure, which is why I asked here). – Mark Amery Dec 19 '12 at 16:07
  • 1
    @jw013 BTW, if you can suggest a more enlightening term I'll use it, but as far as I know this behavior has no proper/official name and I can't think of a succinct and clear name to give it - which is why I described it carefully in my first paragraph instead. – Mark Amery Dec 19 '12 at 16:11
  • 1
    I actually switched to a scroll-wheel-less trackball mouse a while ago so all of this is recollection. I'd probably call it "middle mouse scrolling". If I remember correctly, paste only triggered on a simple click, scrolling happened if you held the button down and moved the mouse around. I might have had some settings in my xorg.conf that helped (I tend to copy over my old xorg.conf customizations to new installs so I don't remember exactly). If you are using GNOME try poking around in your mouse preferences and see if there's anything there. – jw013 Dec 19 '12 at 16:32
  • 1
    @MarkAmery Just in case you didn't already find this, see Gilles' answer to a similar question. The method described by Gilles will enable scroll wheel emulation across all X.Org applications, not just Firefox. – Arkanon May 31 '15 at 9:02
37

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.

9
  • 1
    Awesome. I will try out the extensions at work tomorrow and then accept this answer. I'm fairly convinced by now that for most other applications there simply isn't a solution. – Mark Amery Feb 4 '13 at 18:32
  • @MarkAmery: Yup... For me this is the most annoying thing in Linux... It still annoys me in one of my folders which contains lots and lots of files... Otherwise, as I said, this feature is mostly useful for webpages, for which we have a solution at hand... :) – Aditya Feb 4 '13 at 18:36
  • 2
    It works! Yay! :) – Mark Amery Feb 5 '13 at 9:41
  • Funny it does not work on some websites like https://chrome.google.com/webstore/category/apps?hl=en itself. – dashesy Feb 27 '16 at 19:22
  • 1
    This is the better answer and should be accepted: unix.stackexchange.com/a/421672/115227 – jtolds Mar 10 '18 at 19:01
19

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.
7
  • "For evdev [do one thing]. With libinput: [do another thing]." How do I know which of those applies to me? I've never heard of either before reading this answer. – Mark Amery Feb 3 '18 at 17:28
  • @MarkAmery I don't know a straightforward way, kernel module (modinfo $(lsmod|grep -iE "input" | col1)) doesn't show it. But after you get your deviceID and list properties, if you are using libinput almost all properties will start with that word. Also you will have xserver-xorg-input-libinput package installed, libinput-list-devices command will list your device (certainly on /proc/bus/input/devices). If using X you will find more info diggin on /usr/share/X11/xorg.conf.d/. – Pablo A Feb 3 '18 at 18:10
  • 2
    This is the better answer and should be accepted. – jtolds Mar 10 '18 at 19:01
  • 2
    I tried this and found that not only it doesn't work in all applications, but also, in those where it does work, it feels very hackish and not Windows-like at all. – Marc.2377 Aug 28 '19 at 23:42
  • @Marc.2377 Is there a single Linux feature or program that tries to behave like something on Windows that can't be described in that manner? :( – Adam Barnes Jan 22 at 12:59
2

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].
3
  • 3
    The OP is talking about an issue with all Linux programs,not just Firefox. – ajgringo619 Jan 9 '20 at 0:19
  • xinput is working and tested also useful for all Linux programs,not just Firefox. gnome tweak is also useful for all Linux programs,not just Firefox. i updated the answer . – nikhil swami Jan 9 '20 at 4:48
  • Thank you, this works! – Player1 Apr 30 '20 at 20:47
0

Decided to automate Pablo A's answer, since I found it to be the best one (as it works in all apps, not just Firefox).

Save this file as a script (for example: ~/setup_middle_click_scrolling.sh), make it executable with chmod +x, then run it (you can delete it after you run). It enables middle-click to scroll and also adds a startup script so that you get the functionality whenever you log in.

#!/bin/bash
# Enables middle click to scroll (like Windows).
set -e

: ${SCRIPT_PATH:=$(realpath ~/.config/autostart/middle_click_to_scroll.sh)}
: ${DESKTOP_PATH:=~/.config/autostart/middle_click_to_scroll.desktop}

# Create dirs if they don't exist.
echo "$SCRIPT_PATH" "$DESKTOP_PATH" | xargs dirname | xargs mkdir -p

# Create a script that can be run on-demand.
# When run, it enables middle-click to scroll.
cat > "$SCRIPT_PATH" <<EOF
#!/bin/bash

# Get device IDs of all devices containing "pointer"
pointer_ids=($(xinput list | grep pointer | perl -p -e 's@.*?id=(\d+).*@\1@'))

for pointer_id in "${pointer_ids[@]}"; do
  # If the pointer supports scroll method, set middle click to scroll
  if xinput list-props "\$deviceid" | grep 'Scroll Method Enabled' &>/dev/null; then
    xinput set-prop "\$deviceid" 'libinput Scroll Method Enabled' 0, 0, 1
  fi
done
EOF
chmod +x "$SCRIPT_PATH"

# Create a desktop entry so it runs on startup.
cat > "$DESKTOP_PATH" <<EOF
[Desktop Entry]
Type=Application
Name=Middle click to scroll
Exec="$SCRIPT_PATH"
X-GNOME-Autostart-Phase=Initialization
Terminal=false
NoDisplay=true
EOF

"$SCRIPT_PATH"

Hopefully folks in the comments could point out whether this would work on all systems, but it works with my setup of XFCE + libinput + standard 3-button mouse.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.