June 4, 2009

Getting HAL to allow Horizontal Scrolling

This is how I got it working on my little netbook.  Seems somehow more and more websites are being designed for larger than 1024 wide screens and so horizontal scrolling is becoming more of a need.

Two steps are needed 1st I edited Firefox and then I edited the files for HAL.  In the end we have to reboot the system because somehow the implemintation of X on a number of modern distro's (cough *buntu cough) are more windows like and so every change now requires a reboot. (CNTRL-ALT-BKSpace doesn't work, even when enabled) 

So on to the needed changes.  Open Fx (Firefox) and enter "about:config" (without the quotes) in the URL bar.  If this is the first time you have to promise the Mozilla gods that you'll be a good boy/girl and you are presented with a list of all of the configuration options Fx has.  Now in it's equivalant of a URL bar enter this:

mousewheel.horizscroll.withnokey.action

double click on the config line that is below the bar, and change the 0 to a 1.  Now you are done with Fx. 

Now on to getting it working in X.  Gone are the days of a single config file no matter how long.  Additionally some distro's (see above cough) have decided not to follow the FHS and have put the config files outside of /etc.  No problem despite attempts to hide them so that "dumb users" don't find them (tounge firmly in cheek on that btw) we can locate them.  

The correct place to find the file would be 

 /etc/hal/fdi/policy/

With *buntu and it's derivatives the file is in /usr/share

 /usr/share/hal/fdi/policy/20thirdparty/

The correct file we will edit will be *synaptic.fdi (where the full name can vary by distro) If you don't find it there then at a command line run this:

 locate synaptic | grep fdi

This should allow you to find the correct file.  Now let the editing begin.  open the file you found in your favorite editor. (remember to save a backup copy just in case of an "oh S***" moment, and to edit it as root).  With *ubuntu the file would look something like this: (The code here is edited so that the blog software doesn't pick it up as code, the real version uses angle braces instead of square ones. If you cut and paste be sure to make the required brace change or else it won't work and you may be left with a dead mouse cursor.)

[deviceinfo version="0.2"]
  [device]
    [match key="info.capabilities" contains="input.touchpad"]
        [merge key="input.x11_driver" type="string"]synaptics[/merge]
           [!-- Arbitrary options can be passed to the driver using
             the input.x11_options property since xorg-server-1.5. --]
        [!-- EXAMPLE:
        [merge key="input.x11_options.LeftEdge" type="string"]12[/merge]
        --]
    [/match]
  [/device]
[/deviceinfo]

The important part for us is the lines that start with 

[merge key...... 

We are going to add(or if it exists edit) the line 

 [merge key="input.x11_options.HorizEdgeScroll" type="string"]true[/merge]

Other distro's may have this line there already, and if horizontal scrolling didn't work in regular apps it will say "false" instead of "true".  Edit and change this and you are off and running.   In your *buntu system the file will now look like this:

[deviceinfo version="0.2"]
  [device]
    [match key="info.capabilities" contains="input.touchpad"]
        [merge key="input.x11_driver" type="string"]synaptics[/merge]
        [merge key="input.x11_options.HorizEdgeScroll" type="string"]true[/merge]
        [!-- Arbitrary options can be passed to the driver using
             the input.x11_options property since xorg-server-1.5. --]
        [!-- EXAMPLE:
        [merge key="input.x11_options.LeftEdge" type="string"]120[/merge]
        --]
    [/match]
  [/device]
[/deviceinfo]

Note: In an xml file anything between !-- and -- is a comment make sure you don't add lines in the middle of a comment.  

Now to get your mouse working right.  As mentioned on *buntu you probably need to reboot (cough), however the following procedure should work on all others.  As root restart the hal daemon (/etc/init.d/hal restart), with some you may additionally need to restart X (logout and use Cntrl-Alt-Backspace).  At this point enjoy the scrolling.

More config options for HAL do exist and one place I found a "list" is here in an article at thinkwiki.

Click Here!