SHARE
TWEET

Touchpad shell script

a guest Sep 30th, 2012 215 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. # toggle synaptic touchpad on/off
  4.  
  5. # get current state
  6.  
  7. SYNSTATE=$(synclient -l | grep TouchpadOff | awk '{ print $3 }')
  8.  
  9. lsusb | grep -i mouse > /dev/null
  10. MPLUGGED=$?
  11.  
  12. on()
  13. {
  14.         synclient TouchpadOff=0
  15.         synclient VertEdgeScroll=1
  16.         synclient HorizEdgeScroll=1
  17.         synclient MaxSpeed=4.5 #6
  18.         synclient MinSpeed=1
  19.         synclient VertTwoFingerScroll=1
  20.         synclient HorizTwoFingerScroll=1
  21.         synclient TapButton1=1
  22.         synclient TapButton2=0 #3
  23.         synclient TapButton3=2
  24.         #synclient EmulateTwoFingerMinZ=90
  25.         synclient VertScrollDelta=10
  26.         synclient HorizScrollDelta=10
  27.         #synclient MaxTapTime=0
  28.         synclient CoastingSpeed=0.8
  29.         synclient PalmDetect=1
  30.         synclient PalmMinZ=10
  31.         synclient PalmMinWidth=200
  32.         #synclient CircularPad=1
  33.         echo "Touchpad enabled!"
  34.         #zenity --notification --text="Touchpad enabled!" --window-icon=info
  35.         notify-send --expire-time=2500 -i info "Touchpad" "The touchpad has been enabled!"
  36. }
  37.  
  38. off()
  39. {
  40.         synclient touchpadoff=1
  41.         echo "Touchpad disabled!"
  42.         #zenity --notification --text="Touchpad disabled!" --window-icon=info
  43.         notify-send --expire-time=2500 -i error "Touchpad" "The touchpad has been disabled!"
  44. }
  45.  
  46. toggle()
  47. {
  48.         if [ $MPLUGGED = 0 ]; then
  49.                 off
  50.                 echo "External USB Mouse present!"
  51.                 exit
  52.         fi
  53.         # change to other state
  54.         if [ $SYNSTATE = 0 ]; then
  55.                 off
  56.         elif [ $SYNSTATE = 1 ]; then
  57.                 on
  58.         else
  59.                 echo "What the heck?!"
  60.         fi
  61. }
  62.  
  63. if [ "$#" = "0" ]; then
  64.         toggle
  65. elif [ "$1" = "on" ]; then
  66.         on
  67. elif [ "$1" = "off" ]; then
  68.         off
  69. else
  70.         echo "Touchpad is: $SYNSTATE"
  71. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top