Sharp MM 1 Lid Script

The design of the MM1 is such that when the lid is closed firmly, it presses both mouse buttons simultaneously, resulting in a middle click under X. This often pastes the clipboard into whichever window you were using, which is invariably embarassing.

My solution was to disable the touchpad when the lid was closed using the Synaptics touchpad driver utility. This requires the following change to XF86Config-4:

 Section "InputDevice"
   Driver        "synaptics"
 ...
   Option        "SHMConfig"     "on"

Then, in /etc/acpi/events/jw_lid:

 event=button[ /]lid
 action=/etc/acpi/actions/jw_lid.sh %e

And in /etc/acpi/actions/jw_lid.sh:

 #!/bin/bash

 if 
 then
        /usr/local/bin/synclient TouchpadOff=0
 else
        /usr/local/bin/synclient TouchpadOff=1
 fi

Easy!