screentoggle 342 B

1234567891011121314
  1. #!/bin/sh
  2. declare -i ID
  3. ID=`xinput list | grep -Eo 'Touch Controller\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 "Touchscreen disabled."
  10. else
  11. xinput enable $ID
  12. echo "Touchscreen enabled."
  13. fi