11

I wanted to know how I could configure multi-touch gestures in Ubuntu. In windows I can do this using the synaptics driver software.

I have already used synclient to configure the taps, palmdetect, scroll, etc. But I'd also want gesture support. Is is even possible?

System-Info: Ubuntu 12.10, Synaptics clickpad

rubo77
  • 32,486
kapad
  • 1,062
  • wanted to specify some details: What I wanted to do is to be able to configure a gesture for the browser/nautilus back/forward buttons. In windows I can do this with a 3-finger swipe. Similarly to minimize/open all windows. In Win7 this can be done with a four finger swipe either up or down. I want things similar to the Mac. Is this possible? – kapad Nov 19 '12 at 04:23

2 Answers2

11

Update 9/15/2016 Multitouch works out of the box, and all the solutions listed below (mtrack, synclient, ginn, ...) will mess things up, so if you are updating from an older kernel which requires them, delete all the helper apps and try the out-of-box kernel behavior with the touchpad ui for your desktop manager. It should do what you need, and if you want more gestures and stuff, add easystroke which works well. It is sorted in the stock kernel input drivers now and works without a problem since at least kernel 4.1.32, although some of the early 4.0 kernels would not work. The current LTS kernel, 4.4 works fine, as does 4.7.

update 9/2015...kernels above 3.14 or so have most of multitouch built in now, so try uninstalling mtrack if you have problems. just the built in multitouch driver and easystroke is working fine for me since kernel 3.14, though the 4.0 and up seem to have a regression that breaks the apple trackpad. 3.18 kernel works great though.

There are numerous solutions, most of which are still a little half-baked. Many of the documented ones are out of date, so make sure you look at the date of whatever you google.

Ubuntu has built in rudimentary gestures (2 finger) support in the mouse/touchpad settings applet.
I found it randomly conked out and two finger scrolling would then be mysteriously greyed out, setting me off on a long chain of googling to maybe get it back.
Then I tried touchegg, which sort of worked sometimes.
It is the easiest to configure and there are good instructions but it is based on an older daemon solution to the problem.
The ubuntu multitouch howto (you'll have to google it as I can only include two links) was badly out of date but is slowly getting worked on. It sort of offers another set of patchy solutions, but is in the process of getting updated.

The solution I am currently using is mtrack (in the repos) combined with easystroke (have to compile from source).
Mtrack supports the kernel version of multitouch rather than an ad hoc solution like touchegg and ginn if I understand right, but easystroke is another daemon solution that seems to work well for now on top of mtrack.

Mtrack's approach seems to be the direction development is taking.

uninstall the other stuff (ginn, touchegg) if you use it and then install mtrack from the repos full name is xserver-xorg-input-mtrack.

It is a pain to configure and I have not gotten three fingers to swipe. See the link at the end of the thread for people's various config files. I use an apple magic trackpad and it is pretty good for that, though it has one annoying glitch in that double-tap and drag for example to move a window is erratic. workaround is to either use an actual button click to move windows, or to hesitate a split second after the double tap and hold before moving the window.

I just found easystroke, and until mtrack gets a gui you might want to try that if you are adventurous enough to try compiling a program.

once compiled by running make -j2 and installed by sudo make install, start it with easystroke -g to get the GUI and go to the wiki page for instructions.

One other issue you may need to sort out is the drivers.

If you use mtrack, you might need to renumber the files so your mtrack driver gets read last or the synaptics settings will grab everything.

Those drivers are stored at /usr/share/X11/xorg.conf.d.

copy the mtrack driver to /etc/X11/xorg.conf.d, edit the settings in that folder (see the linked thread and the README for how) to get your three finger goodness if you can (or use easystroke), and rename the file to a higher number so 50-mtrack.conf becomes 60-mtrack.conf, otherwise I found the synaptic driver will grab your touchpad half the time.

Putting the file in /etc means that it will not get overwritten on updates like the /usr files, and that it is read last and thus takes priority over the default drivers in /usr.

Hope this helps. This is an area of fairly active development, so whatever I write will probably be obsolete within a year, hopefully for the better.

  • Hey thanks for this great answer. Sorry it took a while to check it :) – kapad Feb 06 '13 at 21:16
  • Any news about a proper solution about this matter? Still can't get it to work aceptable.. – tomyo May 30 '13 at 04:05
  • There seems to be an easystroke package nowadays, and the -g option is not known to it. Without the argument, it starts a GUI though. :) PS: I run Mint 16. – Herbert May 16 '14 at 13:00
2

I just wanted to suggest using my continuation of mtrack available at github: https://github.com/p2rkw/xf86-input-mtrack, as it supports 3 finger drag (instructions at bottom of readme).

I'm also using it with conjunction with easystroke, but I had to modify easystroke to remove some restriction about absolute devices, with this simple change (I don't remember exact reason for doing this, sorry):

diff --git a/handler.cc b/handler.cc
index 8830ea2..c9e3f91 100644
--- a/handler.cc
+++ b/handler.cc
@@ -563,7 +563,7 @@ protected:
        }
 protected:
        void move_back() {
-               if (!prefs.move_back.get() || (xstate->current_dev && xstate->current_dev->absolute))
+               if (!prefs.move_back.get())
                        return;
                XTestFakeMotionEvent(dpy, DefaultScreen(dpy), orig_x, orig_y, 0);
        }

I also reduced error margin for gestures:

diff --git a/gesture.cc b/gesture.cc
index 8531c08..0df990e 100644
--- a/gesture.cc
+++ b/gesture.cc
@@ -104,9 +104,9 @@ int Stroke::compare(RStroke a, RStroke b, double &score) {
                return -1;
        score = MAX(1.0 - 2.5*cost, 0.0);
        if (a->timeout)
-               return score > 0.85;
+               return score > 0.95;
        else
-               return score > 0.7;
+               return score > 0.92;
 }

... and it works great.

Side note about painful configuration: you can use xinput to configure it on the fly, then edit xorg.conf accordingly, or create startup script with xinput invocations.

terdon
  • 100,812
p2rkw
  • 131