home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / xserver-xorg-input-synaptics / script / usbhid next >
Encoding:
Text File  |  2006-04-16  |  618 b   |  44 lines

  1. #!/bin/bash
  2. #
  3. # This is a little hotplug script that disables the Touchpad when
  4. # you plug in a usb mouse and reenables it when the mouse is unplugged.
  5. #
  6. # Simply put this into /etc/hotplug/usb/usbhid and thats it...
  7.  
  8. SYNCLIENT=/usr/bin/synclient
  9.  
  10. check_for_usb_mouse () {
  11.     if [ "`grep -e Mouse /proc/bus/usb/devices`" ]; then
  12.         $SYNCLIENT TouchpadOff=1
  13.     else
  14.         $SYNCLIENT TouchpadOff=0
  15.     fi
  16. }
  17.  
  18.  
  19. add_device () {
  20.     ln -s /etc/hotplug/usb/usbhid $REMOVER
  21.     check_for_usb_mouse
  22. }
  23.  
  24.  
  25. remove_device () {
  26.     rm $REMOVER
  27.     check_for_usb_mouse
  28. }
  29.  
  30. case $ACTION in
  31.  
  32. add)
  33.     add_device
  34.     ;;
  35. remove)
  36.     remove_device
  37.     ;;
  38. *)
  39.     ;;
  40.  
  41. esac
  42.  
  43. exit 0
  44.