Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

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

share|improve this answer
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. –  np8 Jan 13 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. –  np8 Jan 13 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 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) –  np8 Jan 14 at 9:03
    
@vasa1 may I suggest to move your comment into your answer? –  guntbert Jan 16 at 18:52
show 1 more comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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