Browse Source

Update screen on/off/toggle

Samuel W. Flint 6 years ago
parent
commit
abb2108b10
3 changed files with 28 additions and 20 deletions
  1. 6 4
      screenoff
  2. 6 4
      screenon
  3. 16 12
      screentoggle

+ 6 - 4
screenoff

@@ -1,6 +1,8 @@
 #!/bin/sh
 
-declare -i ID
-ID=`xinput list | grep -Eo 'SYNA7300:00 06CB:177C\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}' | tail -1`
-
-xinput disable $ID
+for ID in $(xinput list | \
+                grep Wacom | \
+                grep -Eo '\s*id\=[0-9]{1,2}' | \
+                grep -Eo '[0-9]{1,2}') ; do
+    xinput disable $ID
+done

+ 6 - 4
screenon

@@ -1,6 +1,8 @@
 #!/bin/sh
 
-declare -i ID
-ID=`xinput list | grep -Eo 'SYNA7300:00 06CB:177C\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}' | tail -1`
-
-xinput enable $ID
+for ID in $(xinput list | \
+                grep Wacom | \
+                grep -Eo '\s*id\=[0-9]{1,2}' | \
+                grep -Eo '[0-9]{1,2}') ; do
+    xinput enable $ID
+done

+ 16 - 12
screentoggle

@@ -1,14 +1,18 @@
 #!/bin/sh
 
-declare -i ID
-ID=`xinput list | grep -Eo 'SYNA7300:00 06CB:177C\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}' | tail -1`
-declare -i STATE
-STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
-if [ $STATE -eq 1 ]
-then
-    xinput disable $ID
-    echo "Touchscreen disabled."
-else
-    xinput enable $ID
-    echo "Touchscreen enabled."
-fi
+for ID in $(xinput list | \
+                grep Wacom | \
+                grep -Eo '\s*id\=[0-9]{1,2}' | \
+                grep -Eo '[0-9]{1,2}') ; do
+    STATE=$(xinput list-props $ID | \
+                grep 'Device Enabled' | \
+                awk '{print $4}')
+    if [ $STATE -eq 1 ]
+    then
+        xinput disable $ID
+        echo "Touchscreen disabled."
+    else
+        xinput enable $ID
+        echo "Touchscreen enabled."
+    fi
+done