screentoggle 357 B

1234567891011121314
  1. #!/bin/sh
  2. declare -i ID
  3. ID=`xinput list | grep -Eo 'SYNA7300:00 06CB:177C\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}' | tail -1`
  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