25

On Ubuntu 13.10, with Chrome browser, gedit, Gimp etc. the Shift + Mouse Scroll == Horizontal scroll.

With Firefox (26.0) it behaves as Back/Forward page, which is really annoying.

How I can disable the Back/Forward functionality, and change it to horizontal scroll?

2

5 Answers 5

18
+50

Here's how I finally got it work. I put it in very detailed form, so anyone can follow it easily.

1) Open terminal (Ctrl+Alt+T)

2) In terminal, run following commands:

sudo apt-get install xautomation
sudo apt-get install xbindkeys

3) Create a new file called .xbindkeysrc.scm to your home directory, by running in terminal

gedit ~/.xbindkeysrc.scm

4) Add the following text to the file, save it, and close the text editor:

; bind shift + vertical scroll to horizontal scroll events
(xbindkey '(shift "b:4") "xte 'mouseclick 6'")
(xbindkey '(shift "b:5") "xte 'mouseclick 7'")

5) In terminal, run command

xbindkeys

6) With Firefox browser, go to address about:config

7) Change following values (double click on value)

mousewheel.with_shift.action to 0 (from the default 2)
mousewheel.with_shift.action.override_x 1 to 1 (from the default -1)

8) Now Shift+Mouse Scroll should lead to horizontal scrolling on Firefox, instead of the default Back/Forward action.


Extra information:

3) .xbindkeysrc.scm is a hidden file (because it starts with a dot), and that's why you cannot see it with nautilus or other filesystem browser by default. You can hit Ctrl+H to see hidden files.

5) It seems, that you have to run it only once -- not at every time you log on. I also tried removing the xbindkeys and the horizontal scroll worked until next reboot/login.

7) If you set them as 1, -1, you will get "diagonal scroll" when trying to scroll fast. That's why I think it is necessary to use options 0, 1 instead of 1, -1.

2
  • 4
    I'll just add that mousewheel.with_shift.delta_multiplier_x;300 increases the horizontal speed to about the same as the vertical for me.
    – Sparhawk
    Aug 20, 2014 at 15:32
  • 1
    The unfortunate thing now is that all apps (not just Firefox) will get button6 instead of shift+button4, and therefore side-scrolling will not work for them. But I used this anyway, as I use firefox so much. Aug 20, 2015 at 22:04
11

You can disable the Back/Forward functionality, by going into about:config and modifying mousewheel.with_shift.action to 1 instead of the default 2.

I could not find a way to enable horizontal scrolling using the mousewheel as you see in Google Chrome but the left and right arrow keys do the job. However, I came across this:

Configure your Linux key binding to make Shift+Mouse wheel send an horizontal scroll event:

Install xbindkeys and xautomation. Edit ~/.xbindkeysrc.scm and write:

; bind shift + vertical scroll to horizontal scroll events
(xbindkey '(shift "b:4") "xte 'mouseclick 6'")
(xbindkey '(shift "b:5") "xte 'mouseclick 7'")

Run xbindkeys

Source

Note that I have not tried the above myself!

You may also want to look at [Shift + Mouse-Scroll-Wheel] Does NOT Scroll Horizontally

7
  • 1
    The answer was partly correct, but with the help of that I got the horizontal scroll working. I will edit this answer and accept it.
    – Niko Fohr
    Jan 13, 2014 at 21:17
  • 1
    Btw. I tried the "xbindkeys"-workaround described here but it did not work. This working answer was found by trying quasirandomly some numbers in the values of mousewheel.with_shift.action and mousewheel.with_shift.action.override_x. I also tried this with and without xbindkeys and xautomation, and seems that xautomation is required to make this work. I don't have any idea why this works, but it works. Please, if you have a better answer or you can describe why this, edit the answer above.
    – Niko Fohr
    Jan 13, 2014 at 21:32
  • @np8, here's what I did: I installed both xbindkeys and xautomation and created ~/.xbindkeysrc.scm exactly as in the answer. I also had previously set mousewheel.with_shift.action to 1. Once I saw I had horizontal scrolling working, I changed 1 to 2 and got the undesirable back/forward instead. So, IMO, a setting of 1 is necessary. I did not need to adjust mousewheel.with_shift.action.override_x and all these values are default.
    – user25656
    Jan 14, 2014 at 3:55
  • Seems that the peer review did not accept my edit. Se here's what I did to get it to work: 1) Install xautomation 2) Change mousewheel.with_shift.action to 0 and mousewheel.with_shift.action.override_x to 1. (no need of xbindkeys)
    – Niko Fohr
    Jan 14, 2014 at 9:03
  • 1
    Seems that my method above does not work. It is because I first installed the xbindkeys and after that ran and removed it, so there must have been something in the memory, which kept the thing working after the remove. I will add my own answer, as @guntbert suggested.
    – Niko Fohr
    Jan 18, 2014 at 8:52
7

Fortunately, there is a Firefox add-on for exactly this: https://addons.mozilla.org/en-US/firefox/addon/shift-scroll/ Works great for me in Firefox 50.1.0

1
  • I like this solution as other modify the shift + scroll behavior in all programs.
    – Marcel
    Dec 21, 2016 at 18:20
2

Since Firefox 58 (this commit in particular) horizontal scrolling is the default action of Shift+Wheel, so no need to do anything special except upgrading Firefox.

0

I have no detailed explanation on why this is working and I discovered it by mistake (or just by simply testing random numbers) but for me it worked by setting mousewheel.with_shift.action to 4.

In my case it behaved like this:

  • -1: completely disabled, scroll works vertically
  • 0: shift+scroll no longer does anything
  • 1: completely disabled, scroll works vertically
  • 2: navigates back and forward
  • 3: zoom in / zoom out, just like ctrl+scroll
  • 4: horizontal scroll only

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .