Multitouch touch-pad support for Linux laptops

Technology

The Synaptics TouchPad device is a common input device for many laptop brands, including models made by Acer, Toshiba, and IBM. Normally, the touchpad is used for single-finger mouse input, but the Synaptics device has rudimentary support for tracking multiple fingers at the same time. Nathan Harrington wrote an article for IBM that shows you how to make use of this to add instant multitouch gesture support to your X applications.

A small perl script uses the synclient command to listen to the touchpad and then send a message to the active window.

Using syclient output for monitoring the TouchPad state is a simple and effective way for adding further interface options to Linux applications. The gestureListener.pl program introduced below opens a pipe to read from the synclient program and processes the TouchPad events to detect gestures. These gestures are linked with keyboard commands sent to the current in-focus application in X Window System.

It’s tricky, because you don’t get a discrete x and y location for each finger. Instead, synclient gives you an average of the inputs, and a count of the number of inputs. It makes detecting a pinch gesture difficult, but Nathan noticed that two fingers at the corners of the pad average to a stable location, while the average location of two fingers near each other tends to wiggle. Using this, he was able to hack together semi-reliable pinch and open-pinch gestures.

With the script installed, you can open any X application and swipe three fingers to the left or right to trigger a left or right keypress. The pinch and open-pinch gestures will trigger a + or – to be sent to the application.

Add multitouch gesture support to a TouchPad-equipped laptop

What will the next generation of Make: look like? We’re inviting you to shape the future by investing in Make:. By becoming an investor, you help decide what’s next. The future of Make: is in your hands. Learn More.

Tagged
Discuss this article with the rest of the community on our Discord server!

ADVERTISEMENT

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 16th iteration!

Prices Increase in....

Days
Hours
Minutes
Seconds
FEEDBACK