Horizontal scrolling in Firefox to Shift+Mouse Scroll (instead of Back/Forward)

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?


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.


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


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