How can I disable arbitrary default multitouch gestures in Unity?
Solution 1
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.
Solution 2
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.
Solution 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));
Solution 4
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.
PS: I couldn't reproduce your problem here to test the solution. I'm sorry for that.
Solution 5
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.
Related videos on Youtube
Comments
-
Svilen over 1 year
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.
-
desgua over 12 yearsCan you just uninstall utouch and keep touchégg?
-
desgua over 12 yearsI suspect you can configure these actions in /etc/ginn/wishes.xml (I'm at mobile, can't test right now)
-
-
Svilen over 12 yearsThat'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.
-
desgua over 12 yearsI've updated the answer.
-
Svilen over 12 yearsDisabling 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.
-
Svilen over 12 yearsBy 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.
-
plopp almost 10 yearshow would that work in current unity 7.2.1?
-
Jeff Ward almost 9 yearsHmm, 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...
-
Kevin over 7 yearsSometime 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. -
Tomilov Anatoliy over 6 yearsHelps a lot. It is too long to wait until single threaded make finish.
-
GrayedFox about 6 yearsBy far the best and most straightforward answer for 16.04 Ubuntu users that are happy to install a GUI version of dconf.
-
Matt over 5 yearsUbuntu 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