XNoHands -- written by Denis Auroux. Version 0.1. This version: 2015/8/13.
http://math.berkeley.edu/~auroux/software/

Disable XInput touch device when pen or eraser device reports proximity, 
to avoid palm events when writing on a tablet PC with pen + touch.

This is free software, available under the GNU General Public License,
version 2 or at your option any later version.

============================================================

* PURPOSE: XNoHands is designed for Tablet PCs running Linux and equipped
with both touch and pen devices.  The devices must be logically separate,
and the pen device must report proximity events.  (This is the case e.g.
with Wacom-based tablet PCs). XNoHands runs in the background of a user
session and disables the touchscreen device whenever the pen device is in
proximity of the screen. This allows the user to reste their hand on the
screen while writing without causing havoc.

* LIMITATIONS: XNoHands only works on systems that have separate XInput
devices for the pen and for the touchscreen; and requires the pen to have
a proximity detection feature.  This should include most pen+touch tablet
PCs that have a Wacom digitizer, and possibly some others too.

* OTHER LIMITATIONS:
- XNoHands must start before any other xinput-enabled application 
  (xournal, gimp, ...) in order to be able to detect proximity events 
  inside the windows opened by those applications.
- XNoHands enables and disables the touchscreen using the same mechanism
  as the command "xinput enable|disable device", and thus interferes with
  the user's ability to manually enable/disable the touchscreen. If you
  need to enable/disable the touchscreen manually, kill the xnohands process
  before doing so, and restart it once you want to resume automatic control.
- XNoHands can only listen to proximity events on two XInput devices, and
  disable one device. This fits most use cases (stylus, eraser, touchscreen).
  If you need to control more XInput devices, run multiple instances.

* COMPILING AND INSTALLING:

- To compile, you will need the X11 development packages (libX11-devel and
  libXi-devel, or similar). To run, you will need the X11 and XInput 
  libraries (packages libX11 and libXi -- already present on most systems).

- Compiling: run "make", or just compile xnohands.c. If your installation 
  is non-standard, add the required gcc flags.

- Testing and checking for input devices: run "./xnohands", and see whether
  the correct input devices are auto-detected for your touchscreen, pen, 
  and eraser. If not, run "xinput list" to find the device IDs on your 
  system, and pass the device IDs as command-line arguments. For example,
  if "xinput list" reports (among others):

Virtual core pointer                    	id=2	[master pointer (3)]
  -> Wacom ISDv4 EC Pen stylus               	id=13	[slave  pointer (2)]
  -> Wacom ISDv4 EC Pen eraser               	id=18	[slave  pointer (2)]
  -> ELAN Touchscreen                        	id=11	[slave  pointer (2)]

  then you can run "./xnohands 11 13 18" to force those device IDs.
  Specify the touchscreen (or device to be disabled) first, then the two
  devices to monitor for proximity events (pen and eraser).
  Beware that software upgrades, or even booting with/without external input
  devices plugged in, can routinely change the device IDs.  If your device
  IDs aren't auto-detected properly and tend to change, you may need to
  write a script to find them for you. A future version of XNoHands may
  allow you to pass the device name instead, which would be more robust.

- Installing and setting up as root: run "make install", or copy the
  executable file into /usr/local/bin and the desktop file into
  /etc/xdg/autostart/ to make XNoHands start with all Gnome/KDE user
  sessions.  If you need to specify manual device IDs, edit
  /etc/xdg/autostart/xnohands.desktop to specify the appropriate command
  line parameters on the line "Exec=..."
  To prevent XNoHands from starting with all user sessions, do not install
  (or remove) /etc/xdg/autostart/xnohands.desktop

- Installing and setting up as user: copy the executable file to its
  intended location; edit xnohands.desktop to adjust the path on the 
  line "Exec=..." (and add command line parameters if you need to specify 
  manual device IDs); and copy it into ~/.config/autostart/  to enable
  automatic start with your Gnome/KDE sessions.

