How can I map the Apple Magic Mouse two-finger swipe to a web browser's back and forward functions?

I have set up this and many other gestures with touchegg. Install it via:

sudo apt-get install touchegg

Configurate touchegg via its configuration file located here:

~/.config/touchegg/touchegg.conf

Configuration for your desired gestures would be the following.

<touchégg>

<settings>
    <property name="composed_gestures_time">15000</property>
</settings>

<application name="All">      

    <gesture type="DRAG" fingers="2" direction="LEFT">
        <action type="SEND_KEYS">Alt+Right</action>
    </gesture>

    <gesture type="DRAG" fingers="2" direction="RIGHT">
        <action type="SEND_KEYS">Alt+Left</action>
    </gesture>

</application>

It's important to follow the last hint of the FAQ if you want to setup two or three finger gestures.

 synclient TapButton2=0
 synclient TapButton3=0
 synclient ClickFinger2=0
 synclient ClickFinger3=0
 synclient HorizTwoFingerScroll=0
 synclient VertTwoFingerScroll=0

Create an executable shell script and fire it up on startup.

This deactivates the two and three finger taps and clicks of the synaptics driver as well as the two finger scrolling. If you want to keep the two finger tap to be the right mouse button click and the two finger scrolling you have to do it with touchegg as well.

I think the magic mouse reports itself as a trackpad as stated here.


I'm not sure this will work with Magic Mouse, but with Magic Trackpad I successfully used xSwipe to get browser back / forward navigation, workspace switch, Scale and Expo actions.