screentoggle 457 B

123456789101112131415161718
  1. #!/bin/sh
  2. for ID in $(xinput list | \
  3. grep Wacom | \
  4. grep -Eo '\s*id\=[0-9]{1,2}' | \
  5. grep -Eo '[0-9]{1,2}') ; do
  6. STATE=$(xinput list-props $ID | \
  7. grep 'Device Enabled' | \
  8. awk '{print $4}')
  9. if [ $STATE -eq 1 ]
  10. then
  11. xinput disable $ID
  12. echo "Touchscreen disabled."
  13. else
  14. xinput enable $ID
  15. echo "Touchscreen enabled."
  16. fi
  17. done