Touchy Emacs

I use Emacs as a music playing interface, and I thought it would be nice try to create a pure touch screen interface, just … because.

The only OS that would install on my old Surface Pro 2 was the prerelease version of Ubuntu 16.04, Xenial Xerus.  Apparently kernels between 2013 and a couple of weeks ago dropped support for the wifi card in the Pro 2, so, but Xerus has it.

And everything works fine.  Except the multitouch.  Apparently Unity only has support for four-digit gestures, and it’s apparently impossible to remap these gestures.  (This is what hours of googling told me.)

To make Unity stop doing this crap, you have to build your own version.  This page explains how, but I’m just going to reiterate what it says, because some things have changed slightly.

sudo apt-get build-dep unity
cd /tmp
mkdir unity
cd unity
apt-get source unity

Then edit this file:

unity-7.4.0+16.04.20151218/plugins/unityshell/src/unityshell.cpp.  Comment out this line

//InitGesturesSupport();

And then build.

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

Then install touchegg.  You need to create mappings between gestures and the events that Emacs will respond to.

<touchégg>
 
 <settings>
 <property name="composed_gestures_time">0</property>
 </settings>
 
 <application name="Emacs">

 <gesture type="TAP" fingers="2" direction="">
 <action type="SEND_KEYS">space</action>
 </gesture>
 
 <gesture type="TAP" fingers="3" direction="">
 <action type="SEND_KEYS">p</action>
 </gesture>
 
 <gesture type="DRAG" fingers="2" direction="UP">
 <action type="SEND_KEYS">Control+v</action>
 </gesture>

 <gesture type="DRAG" fingers="2" direction="DOWN">
 <action type="SEND_KEYS">Alt+v</action>
 </gesture>
 </application>

</touchégg>

Etc etc.  And here’s the result: A Surface Pro 2 playing in the kitchen while I’m programming on the patio:

I kinda really wanted to delve into creating a proper touch interface for Emacs, where you could define gestures as you want with a simple (local-set-key [(swipe up three-fingers]) ‘do-something), but this stuff seems like it’s way immature.  Still.  After all these years.  Or perhaps I’ve just not found the right documentation on dar webs.

2 thoughts on “Touchy Emacs”

Leave a Reply