touchtoggle 329 B

1234567891011121314
  1. #!/bin/sh
  2. declare -i ID
  3. ID=`xinput list | grep -Eio 'Touchpad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
  4. declare -i STATE
  5. STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
  6. if [ $STATE -eq 1 ]
  7. then
  8. xinput disable $ID
  9. echo "Touchpad disabled."
  10. else
  11. xinput enable $ID
  12. echo "Touchpad enabled."
  13. fi