Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # toggle synaptic touchpad on/off
- # get current state
- SYNSTATE=$(synclient -l | grep TouchpadOff | awk '{ print $3 }')
- lsusb | grep -i mouse > /dev/null
- MPLUGGED=$?
- on()
- {
- synclient TouchpadOff=0
- synclient VertEdgeScroll=1
- synclient HorizEdgeScroll=1
- synclient MaxSpeed=4.5 #6
- synclient MinSpeed=1
- synclient VertTwoFingerScroll=1
- synclient HorizTwoFingerScroll=1
- synclient TapButton1=1
- synclient TapButton2=0 #3
- synclient TapButton3=2
- #synclient EmulateTwoFingerMinZ=90
- synclient VertScrollDelta=10
- synclient HorizScrollDelta=10
- #synclient MaxTapTime=0
- synclient CoastingSpeed=0.8
- synclient PalmDetect=1
- synclient PalmMinZ=10
- synclient PalmMinWidth=200
- #synclient CircularPad=1
- echo "Touchpad enabled!"
- #zenity --notification --text="Touchpad enabled!" --window-icon=info
- notify-send --expire-time=2500 -i info "Touchpad" "The touchpad has been enabled!"
- }
- off()
- {
- synclient touchpadoff=1
- echo "Touchpad disabled!"
- #zenity --notification --text="Touchpad disabled!" --window-icon=info
- notify-send --expire-time=2500 -i error "Touchpad" "The touchpad has been disabled!"
- }
- toggle()
- {
- if [ $MPLUGGED = 0 ]; then
- off
- echo "External USB Mouse present!"
- exit
- fi
- # change to other state
- if [ $SYNSTATE = 0 ]; then
- off
- elif [ $SYNSTATE = 1 ]; then
- on
- else
- echo "What the heck?!"
- fi
- }
- if [ "$#" = "0" ]; then
- toggle
- elif [ "$1" = "on" ]; then
- on
- elif [ "$1" = "off" ]; then
- off
- else
- echo "Touchpad is: $SYNSTATE"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement