]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blobdiff - contrib/listen_lid.sh
New upstream version 1.11
[deb_pkgs/autorandr.git] / contrib / listen_lid.sh
index 976b26d65d1aa6d86156ec036da7a455eea77e98..8de7eb64e8dfc1ab9c4b4c0d0205f60d4769a8da 100755 (executable)
@@ -1,8 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # /!\ You must be part of the input group
 # sudo gpasswd -a $USER input
 
-libinput debug-events | grep SWITCH_TOGGLE | while read event; do
+stdbuf -oL libinput debug-events | \
+    grep -E --line-buffered '^[[:space:]-]+event[0-9]+[[:space:]]+SWITCH_TOGGLE[[:space:]]' | \
+    while read line; do
     autorandr --change --default default
 done