22

I'm using a custom Touchégg multitouch gesture setup in Ubuntu 11.04 with a Magic Trackpad. Since the default gestures (such as 3-finger tap and drag to move windows, 4 finger tap to reveal the dash, etc.) are apparently hardcoded in Unity, I'm unable to assign any custom Touchégg actions to them, and some default gestures (that I don't intend to use much, if at all) occasionally mix up with my similar custom-assigned ones and get triggered by accident.

Is there a practical way (short of tweaking the uTouch source) to disable some of the default gestures? If not, pointers to parts of the code (perhaps in grail?) where the default gestures are defined, and help with tweaking would also be appreciated.

3
  • 1
    Can you just uninstall utouch and keep touchégg?
    – desgua
    Aug 21, 2011 at 20:00
  • 1
    Touchégg makes use of utouch-geis, so no, not in any remotely practical sense.
    – mgunes
    Aug 23, 2011 at 3:06
  • I suspect you can configure these actions in /etc/ginn/wishes.xml (I'm at mobile, can't test right now)
    – desgua
    Aug 23, 2011 at 10:56

7 Answers 7

16

An update to domster answer for Ubuntu 12.10.

Unity source code has obviously changed, so here is how to achieve the same in Unity 6.8.0. The steps to download Unity source code are the same as before (I will copy & paste domster's snippet):

sudo apt-get build-dep unity
cd /tmp  #It can be done somewhere else, feel free to change the base location.
mkdir unity
cd unity
apt-get source unity

At this point, the file to be edited is only /tmp/unity/unity-6.8.0/plugins/unityshell/src/unityshell.cpp.

Find the method UnityScreen::InitGesturesSupport() (line 3368 for Unity 6.8.0).

Then, comment all the lines starting with gesture_sub_launcher to make it look like:

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();
  */
}

Re-build Unity following domster's instructions again:

cd /tmp/unity/unity-6.8.0
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *deb

Et voila again! Logout and log back in.

4
  • how would that work in current unity 7.2.1?
    – plopp
    Jun 24, 2014 at 5:27
  • This answer is still 100% valid for Unity 7.2.2 (so I'm assuming it's also valid for 7.2.1). I'm building right now, will update on what happens re. touchegg once I'm done and rebooted.
    – Endophage
    Aug 20, 2014 at 4:34
  • 1
    Sometime between Trusty and Xenial, settings to disable Unity gestures have been added to dconf, listed under com.canonical.unity.gestures. If may also be available in Wily, but I don't think so; I'm only positive that it's not available in Trusty, and is in Xenial.
    – Kevin
    Sep 1, 2016 at 20:17
  • Ubuntu 16: dpkg-buildpackage -us -uc -nc exits with errors. error: debian/rules build gave error exit status 2... The X server was not able to run in time .... recipe for target 'tests/CMakeFiles/run-test-switcher-controller-slow-headless' failed
    – Matt
    Jan 16, 2019 at 21:52
11

It turns out that it is not that hard to patch the unity package for totally disabling its handling of multi-touches and gestures. Here are step by step instructions for patching unity-4.24.0.

In a command line, enter:

sudo apt-get build-dep unity
cd /tmp  #It can be done somewhere else, feel free to change the base location.
mkdir unity
cd unity
apt-get source unity

At this point, comment out the following 2 lines in the file /tmp/unity/unity-4.24.0/plugins/unityshell/src/unityshell.cpp:

GeisAdapter::Default()->Run();
gestureEngine = new GestureEngine(screen);

and the following 4 lines in the file /tmp/unity/unity-4.24.0/plugins/unityshell/src/Launcher.cpp:

GeisAdapter& adapter = *(GeisAdapter::Default());
adapter.drag_start.connect(sigc::mem_fun(this, &Launcher::OnDragStart));
adapter.drag_update.connect(sigc::mem_fun(this, &Launcher::OnDragUpdate));
adapter.drag_finish.connect(sigc::mem_fun(this, &Launcher::OnDragFinish));

The source code is in C++, so commenting a line is done by adding // at the beginning of the line. For instance, the line

GeisAdapter::Default()->Run();

becomes

//GeisAdapter::Default()->Run(); .

Back to the command line, enter:

cd unity-4.24.0
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *deb

Et voila!

Now if you logout and log back in, gestures should function normally. Triple tap works on my system as a middle click by default, without a need for touchegg. But both touchegg and ginn now work well to define custom gestures for your applications.

0
3

To do this on latest unity (5.18.0) in 12.04 you have to comment-out slightly different code lines.

In plugins/unityshell/src/Launcher.cpp:

// GeisAdapter& adapter = GeisAdapter::Instance();
// adapter.drag_start.connect(sigc::mem_fun(this, &Launcher::OnDragStart));
// adapter.drag_update.connect(sigc::mem_fun(this, &Launcher::OnDragUpdate));
// adapter.drag_finish.connect(sigc::mem_fun(this, &Launcher::OnDragFinish));

In plugins/unityshell/src/unityshell.cpp:

// geis_adapter_.Run();
// gesture_engine_.reset(new GestureEngine(screen));
2

Second try

dinegri suggest that ' [t]o disable three gestures, it [is] necessary [to] have installed ccsm, [and then] disable "Unit MT Grab Handles" also know as "Loves Handles" ' here.

But it leaves us with the four finger gestures yet.

First try

The configuration file for utouch is /etc/ginn/wishes.xml. So you can edit this file and remove (or comment) the actions you don't want. Then Touchégg would do its job without conflicts.

Reference

PS: I couldn't reproduce your problem here to test the solution. I'm sorry for that.

4
  • That's the configuration file for ginn, which is a gesture injector, whose functionality overlaps with that of Touchégg. Modificiations to its configuration file would only have effect if the ginn daemon is running, which since I'm using Touchégg, it normally isn't. With the possibility of using ginn instead of Touchégg in mind, I've tried overriding some default Unity gestures by commenting them out in the ginn configuration file and running ginn, but that doesn't work.
    – mgunes
    Aug 24, 2011 at 1:15
  • I've updated the answer.
    – desgua
    Aug 24, 2011 at 16:38
  • 4
    Disabling the handles plugin will only remove the visual affordance for dragging; it will not even disable the three finger tap and drag gesture (which I don't particularly want to disable anyway), let alone the others.
    – mgunes
    Aug 24, 2011 at 17:31
  • By the way, I already have it disabled, since due to bug #754000, I need to simulate the middle button click with Touchégg, and having the handles appear every time I perform a three finger tap is very disorienting.
    – mgunes
    Aug 24, 2011 at 17:36
2

Disable standard touch gestures as follows:

sudo apt install dconf-editor
dconf-editor

In the left-hand menus click to

com > canonical > unity > gestures

and disable the 3 basic gestures shown there. This works on 16.04.3.

1
  • By far the best and most straightforward answer for 16.04 Ubuntu users that are happy to install a GUI version of dconf.
    – GrayedFox
    Feb 26, 2018 at 3:07
1

We've built a Ubuntu based kiosk terminal, but the multitouch gestures revealed the OS, so we had to get rid of that somehow.

It was a Samsung touchscreen device, xinput identified the touch module as AFO TCM10J 40V.

To disable multitouch gestures on Ubuntu 14.04 the method is basically the same as domster described above, except you have to find an comment the following row in /tmp/unity/unity-4.24.0/plugins/unityshell/src/Launcher.cpp

// InitGestureEngine();
1
  • Hmm, this didn't appear to work for me. touchegg and ginn still don't report any data for gestures less than 4 fingers, and the "Two Finger Scroll" setting in the system touchpad settings still takes precedence...
    – Jeff Ward
    Jun 29, 2015 at 21:29
1

Note that dpkg-buildpackage can be given number of jobs as argument, which allows you to use all your CPU cores like this:

dpkg-buildpackage -us -uc -nc -j$(($(nproc)))

(This should have been a comment to dgraziotin's answer, but I can't post comments.)

1
  • Helps a lot. It is too long to wait until single threaded make finish. Sep 18, 2017 at 7:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .