Directly to the content


twofing is a daemon which runs in the background and recognizes two-finger gestures performed on a touchscreen and converts them into mouse and keyboard events. This way, such gestures can be used in almost all existing applications (even ones where you wouldn’t expect it, like Wine applications) without having to modify them.

Main development of twofing took place in 2010.

twofing is only an intermediate step which is necessary until proper multitouch support along the whole software stack of a typical Linux-based system is available. It reads raw multitouch events from the kernel, bypassing X, and has to do some dirty things like grabbing the input device so the multi-touch actions are not passed to the applications as normal mouse events. It can hopefully be replaced one day by a proper multitouch framework. But for now, it works reliably, is surprisingly stable and provides some advanced features, like kinetic scrolling.


twofing currently recognizes the following two-fingered gestures: Two-fingered tap, two-fingered scroll, two-fingered zoom, two-fingered rotate. It blocks input so these gestures don't reach the underlying application as normal mouse events. It creates mouse and key events and sends them to the application instead. To be able to do this, the daemon needs different profiles for different applications. Here is what should work at the moment:

  • Eye of Gnome (Ubuntu's default picture viewer): Zoom, scroll, rotate, right click
  • Evince (Ubuntu's default document (PDF) viewer): Zoom, scroll, rotate, right click
  • F-Spot: Zoom, scroll, right click
  • Almost every other application: Scroll, right click, for many (like Firefox, Nautilus, LibreOffice/OpenOffice) also zoom

Unfortunately, applications which use extended input capabilities like Gimp, Xournal or MyPaint don't work correctly with the daemon if extended input is enabled in these applications.

Try it out

To use twofing on your device, please perform the following steps:

  1. Download the source package.
  2. Extract it to a folder of your choice (e.g. your home dir)
  3. Open a terminal and navigate to the extracted folder (e.g. cd ~/twofing-0.1.2 if you extracted it to your home dir)
  4. Install the required packages: sudo apt-get install build-essential libx11-dev libxtst-dev libxi-dev x11proto-randr-dev libxrandr-dev
  5. Compile the daemon by calling make
  6. Install the daemon by calling sudo make install
  7. Reboot
  8. Open a terminal again and call twofing (nothing will seem to happen)
  9. Open your favourite application and perform gestures on the screen with two fingers
  10. Enjoy

To stop the daemon, simply call killall twofing

Add the command twofing --wait to your startup programs to make twofing start automatically after login.

Important: twofing currently only works with the eGalax touchscreen of the Eee PC T101MT. How easy it would be to adapt it to other devices depends on the device; for many, simply altering the udev rule should be enough. As I don’t have any other hardware to test it, I can’t currently do anything about that. If you want to make it work with a different device, please feel free to send me a message.

Wanna contribute?

You find twofing on github:

Or clone the repository right now: git clone

Comments about this page

#1 thermatk complained on Feb 17, 2012 at 09:03:

Twofing is not working in Precise Alpha 2... it's just not starting the daemon.
Please help me)))

#2 Plippo explained on Feb 17, 2012 at 16:55:

Sorry, but currently there is no Precise support in twofing. I usually start updating the tool after the first beta. To find out what the problem is, you can try starting twofing in the terminal with the --debug option.

#3 thermatk said on Feb 17, 2012 at 17:09:

It's not starting anyway:(
Beta will come soon, I will wait=)
Thank you for support!

#4 holzi said on Nov 5, 2013 at 18:04 in German:

Twofing scheint unter Ubuntu 13.10 Probleme zu haben. Mal funktioniert es, mal nicht. Meistens leider letzteres.

#5 Philipp explained on Nov 6, 2013 at 20:02 in German:

Hallo holzi, leider habe ich gerade kein System, auf dem ich das nachvollziehen könnte. Du könntest einmal ein Terminal öffnen und nacheinander folgende beiden Befehle ausführen:

killall twofing
twofing --debug

Nach dem zweiten kannst du das Terminal dann minimieren (nicht schließen!) und ganz normal mit twofing arbeiten. Wenn es dann nicht mehr funktioniert, kannst du das Terminal wieder aufrufen, die Ausgabe herauskopieren und mir schicken, dann schaue ich mir das mal an.

#6 Chris said on Apr 29, 2014 at 21:14:

Hi, I just bought a Lenovo Thinkpad with touchscreen. Twofing doesn't start on Ubuntu Precise, any plans to make it work? I'll be willing to do some debugging.. :)

#7 Philipp answered on May 1, 2014 at 21:23:

Hi Chris,

twofing should actually work in Precise, but probably your touch screen is not in the list of supported devices yet. If you send me the output of the following two commands, I'll gladly try to support you with making it work.
First command:
twofing --debug
Second command:

#8 spariant said on Dec 21, 2014 at 19:20:

Hi Philipp.
Great tool. I'm trying to make it work on my HP laptop, Opensuse 13.2, Gnome3.14.
Another user had great success recently (with an Ntrig digitizer):

I get this error with twofing --debug:

twofing, the two-fingered daemon
/dev/twofingtouch: No such file or directory

What is missing?
In any case, my lsusb:
Bus 002 Device 004: ID 04f3:023e Elan Microelectronics Corp.

and cat /proc/bus/input/devices:
I: Bus=0003 Vendor=04f3 Product=023e Version=0110
N: Name="ELAN Touchscreen"
P: Phys=usb-0000:00:14.0-6/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb2/2-6/2-6:1.0/0003:04F3:023E.0002/input/input14
U: Uniq=
H: Handlers=mouse0 event13
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=3273800000000003

#9 Philipp answered on Dec 22, 2014 at 09:18:

Hi spariant,
in the best case there's only an udev rule missing.
You can try that by calling the command
twofing --debug /dev/input/event13
in a root terminal or using sudo. Maybe you need to adjust the event number, that sometimes changes between reboots.
Depending on the result of this I can try to help you further.

#10 spariant responded on Dec 22, 2014 at 12:45:

It's working very well now! debug registers all events!
twofing --debug /dev/input/event14
twofing, the two-fingered daemon

Input device name: "ELAN Touchscreen"
XInput device id is 10.
XInput device id for calibration is 10.
Start calibration
No calibration data found, use default values.
Calibration: MinX: 0; MaxX: 3264; MinY: 0; MaxY: 1856
Invert X Axis: No
Invert Y Axis: No
Swap Axes: No
Calibration Matrix: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
Grab Result: 0
Reading input from device ... (interrupt to exit)
Use default profile.
Start scrolling gesture
Can you point me to where the config files are? I can adjust the scrolling speed etc.

Some problems now:
. in app "epiphany", zoom gesture causes a one-step scroll. Any idea why?
. no input reaches gnome-shell anymore. So 3 and 4 finger gestures (implemented in gnome 3.14) don't work. But this is part of the program, I understand...

#11 Philipp explained on Dec 22, 2014 at 16:20:

Unfortunately there is no config file, you need to change the source code in profiles.h and recompile.
In profiles.h you find profiles for different applications and a default profile that is used for the rest. Here you can change parameters, e.g. for scrolling speed the parameters hscrollStep and vscrollStep.

Regarding epiphany: in the default profile, twofing translates a zoom gesture into ctrl+mouse wheel. Maybe zooming doesnt work with this in epiphany?

Yes, unfortunately twofing doesnt work together with native multitouch in Gnome.

#12 Fabrice said on Nov 3, 2015 at 18:43:


I try to use twofing on a Raspbian wheezy (rpi) and this screen touch :!/14-HDMI-interface-LCD-with-capacitive-touchscreen/p/36248806/category=3094861

the one fin it's ok but when I try twofin --debug the pointer stay on the corner up left ...

have you a ideà ?

#13 Philipp said on Nov 4, 2015 at 20:39 in German:

Hi Fabrice,
I can't promise you that every touchscreen works with twofing. The tool hasn't really been maintained over the last couple of years. What is the output on your screen when you enter twofing --debug and start moving your fingers on screen?

#14 Fabrice said on Nov 5, 2015 at 08:25:

in fact I have try with jessie and it's work (but I need some software dont comatible with jessie so I need wheezy) can you have and idea witch change between jessie and wheeze ?

in wheezy (now) in fact two fing is "done" if I double tap or sweep ... i see in the debug it's done but the cursor no move and when i kill twofing cursor "re"-move

#15 Philipp said on Nov 8, 2015 at 21:21:

Sorry, I don't know what's changed between the two versions. But again, for me to be able to help you, please post the screen output of twofing --debug. Enter the command, move your fingers on the screen, perform a few gestures and then copy the output in the terminal window here.

#16 güni complimented on Feb 22, 2016 at 20:00 in German:

Hallo, Philipp, vielen Dank für twofing.
Es läuft auf Linux Mint 17.3 XFCE mit einem acer 1825ptz
ausgezeichnet. Endlich kann ich das konvertible mit Linux so nutzen, wie es vorgesehen ist.

#17 Ground0 said on Feb 25, 2016 at 17:27 in German:

Hallo Philipp,
Twofing funktioniert wie vorgesehen und einwandfrei so lange beim Start keine Maus eingesteckt ist ... gerne kann ich dir Infos geben wenn du mir sagst was gebraucht wird.
Habe jetzt mal ein .desktop Autostart hinterlegt so dass es fast bei jedem Desktop mit gestartet wird und es funktioniert :-) Das Tablet erfreut sich nun unter allen Applikationen über die 2finger funktion.

#18 avka said on Mar 27, 2016 at 18:20 in German:

Funktionert twofing auch auf touchpads? Z.B. synaptics?

#19 Philipp answered on Mar 27, 2016 at 18:30 in German:

Nein, leider nur mit absoluten Eingabegeräten, also Touchscreens etc.

#20 onestarblack said on May 30, 2016 at 10:18 in German:

Hi Philipp!
Lässt sich mit diesem Tool auch der mittlere Maus-Button simulieren?
In der "profiles.h" gibt es beim defaultProfile folgenden Eintrag:
.tapAction = { ACTIONTYPE_BUTTONPRESS, 3, 0 }
Wäre es hier schon ausreichend den Wert von 3 auf 2 zu ändern um die einen Klick mit der mittleren Maustaste auszulösen?
Danke und Grüße

#21 Philipp said on May 30, 2016 at 13:07 in German:

Ja das funktioniert, ich weiß nur nicht auswendig was der richtige Wert ist. Probier es am besten einfach mal aus.

#22 Joel Horne said on Jun 26, 2016 at 14:05:

Hi Philipp, I'm trying to install twofing on a 10" waveshare capacitive touchscreen. I type "twofing --debug" and i get "/dev/twofingtouch: No such file or directory". Any help you can provide? I'm a little bit green to programming.

#23 Joel Horne said on Jun 26, 2016 at 14:10:

cat /proc/bus/input/devices

I: Bus=0003 Vendor=0483 Product=5710 Version=0100
N: Name="WWW.PowerMCU.COM Multi Media Development Board V1.0"
P: Phys=usb-3f980000.usb-1.3/input0
S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:0483:5710.0001/input/input0
U: Uniq=6D72245C5753e
H: Handlers=mouse0 event0 js0
B: EV=1b
B: KEY=10000 0 0 0 0 0 0 0 0
B: ABS=3
B: MSC=10

I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="Raspberry Pi Sense HAT Joystick"
P: Phys=rpi-sense-joy/input0
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=kbd event1
B: EV=100003
B: KEY=1680 0 0 10000000


Bus 001 Device 006: ID 7392:7822 Edimax Technology Co., Ltd
Bus 001 Device 005: ID 0483:5710 STMicroelectronics Joystick in FS Mode
Bus 001 Device 004: ID 0b05:17cb ASUSTek Computer, Inc.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

#24 Philipp answered on Jun 29, 2016 at 17:42 in German:

Hi Joel, if you know the event device file of your touchpad, you can try manually starting twofing with the following command
sudo twofing --debug /dev/input/event13
where event13 is the name of the event device. From your console output above I can't really tell which one is your touchscreen. But if it is correctly recognized by the kernel, you can just try out the different available event devices from event0 on until you find one that works.

One more comment awaiting publication

Write a comment

Back to the top