This post, show how we can disable Unity default multitouch gestures and 
bring in Ubuntu 13.04 like touchpad gestures.

General idea:
1. We have to disable multitouch gestures form unity, because Gesture support 
in Unity using touchpads was removed by design. The 3-finger and 4-finger 
gestures now only work with a touchscreen.
(see http://bugs.launchpad.net/ubuntu/+source/unity/+bug/1172172)
2. Install touchegg for multitouch gesture
3. Fix some issues to get touchegg works fine.


Now follow these steps:

# part 1, disable multitouch gestures from unity
sudo apt-get build-dep unity
cd /tmp
mkdir unity
cd unity
apt-get source unity

edit file /tmp/unity/unity-*/plugins/unityshell/src/unityshell.cpp 
and locate the method UnityScreen::InitGesturesSupport() (line 3381 for Unity 
6.10.0, line 3287 for Unity 7.0.0), we comment all the lines starting with 
gestures_.


**************************
void UnityScreen::InitGesturesSupport()
{
  std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);
  wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));
  /*
  gestures_sub_launcher_.reset(new nux::GesturesSubscription);
  gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);
  gestures_sub_launcher_->SetNumTouches(4);
  gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW());
  gestures_sub_launcher_->Activate();

  gestures_sub_dash_.reset(new nux::GesturesSubscription);
  gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE);
  gestures_sub_dash_->SetNumTouches(4);
  gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW());
  gestures_sub_dash_->Activate();

  gestures_sub_windows_.reset(new nux::GesturesSubscription);
  gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE
                                         | nux::DRAG_GESTURE
                                         | nux::PINCH_GESTURE);
  gestures_sub_windows_->SetNumTouches(3);
  gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());
  gestures_sub_windows_->Activate();
  */
}
*****************************

cd /tmp/unity/unity-*
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *deb
sudo apt-get -f install
sudo apt-get autoremove


Optionally follows blocks updates to Unity:
echo "unity hold"|sudo dpkg --set-selections

# part 2
sudo apt-get install touchegg

edit ~/.config/touchegg/touchegg.conf (create the directories if they do
not exit)

*************
<touchégg>
    
    <settings>
        <property name="composed_gestures_time">0</property>
    </settings>
    

    <application name="All">
        
        <gesture type="TAP" fingers="2" direction="">
            <action type="MOUSE_CLICK">BUTTON=3</action>
        </gesture>
    
        <gesture type="TAP" fingers="3" direction="">
            <action type="MOUSE_CLICK">BUTTON=2</action>
        </gesture>

        <gesture type="TAP" fingers="5" direction="">
            <action type="CLOSE_WINDOW"></action>
        </gesture>

        <gesture type="DRAG" fingers="2" direction="ALL">
            <action type="SCROLL">SPEED=7:INVERTED=false</action>
        </gesture>
        <gesture type="DRAG" fingers="3" direction="UP">
            <action type="MAXIMIZE_RESTORE_WINDOW"></action>
        </gesture>        
        <gesture type="DRAG" fingers="3" direction="DOWN">
            <action type="MINIMIZE_WINDOW"></action>
        </gesture>        

        <gesture type="DRAG" fingers="3" direction="LEFT">
            <action type="SEND_KEYS">Control+Alt+Left</action>
        </gesture>
        
        <gesture type="DRAG" fingers="3" direction="RIGHT">
            <action type="SEND_KEYS">Control+Alt+Right</action>
        </gesture>

        <gesture type="DRAG" fingers="4" direction="UP">
            <action type="SEND_KEYS">Super+w</action>
        </gesture>
        
        <gesture type="DRAG" fingers="4" direction="DOWN">
            <action type="SEND_KEYS">Super+d</action>
        </gesture>

        <gesture type="PINCH" fingers="3" direction="ALL">
            <action type="RESIZE_WINDOW"></action>
        </gesture>
        
        <gesture type="PINCH" fingers="5" direction="ALL">
            <action type="SEND_KEYS">F1</action>
        </gesture>

    </application>
    
    <application name="Okular, Gwenview">
killall -9 touchegg ; toucheggkillall -9 touchegg ; touchegg
        <gesture type="PINCH" fingers="2" direction="IN">
            <action type="SEND_KEYS">Control+KP_Add</action>
        </gesture>

        <gesture type="PINCH" fingers="2" direction="OUT">
            <action type="SEND_KEYS">Control+KP_Subtract</action>
        </gesture>

        <gesture type="ROTATE" fingers="2" direction="LEFT">
            <action type="SEND_KEYS">Control+L</action>
        </gesture>

        <gesture type="ROTATE" fingers="2" direction="RIGHT">
            <action type="SEND_KEYS">Control+R</action>
        </gesture>

    </application>


    <application name="Chromium-browser">

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

        <gesture type="DRAG" fingers="2" direction="RIGHT">
            <action type="SEND_KEYS">Alt+Right</action>
        </gesture>
        
    </application>
    
    <application name="Google-chrome">

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

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

    </application>


</touchégg>
*************

To automatically start Touchegg when Unity start, create 
~/.config/autostart/touchegg.desktop 
with the followin content

[Desktop Entry]
Version=0.1
Name=Touchegg
GenericName=Touchégg
Comment=Touchégg Gestures Manager
Exec=/usr/bin/touchegg %u
Terminal=false
Type=Application


Then restart

# Part 3
Touchegg doesnt work with 2 finger so we changed it with synclient in file 
script.

Create a file touchpad_settings.sh with the content:
synclient TapButton2=0
synclient TapButton3=0
synclient ClickFinger2=0
synclient ClickFinger3=0
synclient HorizTwoFingerScroll=0
synclient VertTwoFingerScroll=0

Then make it executable:
chmod +x ~/touchpad_settings.sh

And finally, run the following command replacing "user" with your user name:
gsettings set org.gnome.settings-daemon.peripherals.input-devices 
hotplug-command "/home/user/touchpad_settings.sh"

Restart

So finally, we can test gestures and work fine.


References:
http://task3.cc/1068/os-x-like-multitouch-gestures-for-macbook-pro-running-ubuntu-12-10/
https://code.google.com/p/touchegg/issues/detail?id=164
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/1174395
http://askubuntu.com/questions/130393/how-to-configure-the-touchpad-middle-click
http://bugs.launchpad.net/ubuntu/+source/unity/+bug/1172172


** Bug watch added: code.google.com/p/touchegg/issues #164
   http://code.google.com/p/touchegg/issues/detail?id=164

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1172172

Title:
  Some multitouch gestures not working on 13.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/unity/+bug/1172172/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to