#!/bin/bash # enter / fn+enter=esc # page down / fn+pdn=tab # page up / fn+pup=rotate # fn / fn+fn=menu # using xreplay is not ideal, and X-specific # perhaps we can synthesize keypress using /dev/input/uinput ? case $1 in enter ) if test -f /tmp/tablet-fn ; then echo -n "" | xreplay CurrentWindow rm /tmp/tablet-fn ; else echo -n "" | xreplay CurrentWindow ; fi ;; down ) if test -f /tmp/tablet-fn ; then echo -n "" | xreplay CurrentWindow rm /tmp/tablet-fn ; else echo -n "" | xreplay CurrentWindow ; fi ;; up ) if test -f /tmp/tablet-fn ; then ## with a working ranr extension, we could rotate display ## xrandr -o rm /tmp/tablet-fn ; else echo -n "" | xreplay CurrentWindow ; fi ;; fn ) if test -f /tmp/tablet-fn ; then rm /tmp/tablet-fn ; else touch /tmp/tablet-fn ; fi ;; key ) xscreensaver-command -lock ;; # avoid doing xscreensaver-command -lock if we are already locked; # unlock ? or perhaps do something different * ) echo "usage: $0 enter|down|up|fn|key" ;; esac