toggletouch 388 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. turn_on()
  3. {
  4. synclient TouchpadOff=0
  5. echo "Touchpad turned on"
  6. }
  7. turn_off()
  8. {
  9. synclient TouchpadOff=1
  10. echo "Touchpad turned off"
  11. }
  12. is_on()
  13. {
  14. [ "$(synclient -l | grep TouchpadOff | cut -d'=' -f2)" -eq 0 ]
  15. }
  16. if [ $# -eq 1 ]; then
  17. if [ "$1" = "1" -o "$1" = "on" -o "$1" = "true" -o "$1" = "yes" ]; then
  18. turn_on
  19. else
  20. turn_off
  21. fi
  22. else
  23. is_on && turn_off || turn_on
  24. fi