Improvement of the regex performance for lid monitoring
This version of the regex avoids reading entire lines from the libinput output, and concentrates on the event field.
This commit is contained in:
parent
5a5006c0ed
commit
f6ae945187
|
@ -2,5 +2,5 @@
|
|||
Name=Autorandr Lid Listener
|
||||
Comment=Trigger autorandr whenever the lid state changes
|
||||
Type=Application
|
||||
Exec=bash -c "stdbuf -oL libinput debug-events | grep --line-buffered SWITCH_TOGGLE | while read line; do autorandr --change --default default; done"
|
||||
Exec=bash -c "stdbuf -oL libinput debug-events | egrep --line-buffered '^ event[0-9]+\s+SWITCH_TOGGLE\s' | while read line; do autorandr --change --default default; done"
|
||||
X-GNOME-Autostart-Phase=Initialization
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
# /!\ You must be part of the input group
|
||||
# sudo gpasswd -a $USER input
|
||||
|
||||
stdbuf -oL libinput debug-events | grep --line-buffered SWITCH_TOGGLE | while read line; do
|
||||
stdbuf -oL libinput debug-events | \
|
||||
egrep --line-buffered '^ event[0-9]+\s+SWITCH_TOGGLE\s' | \
|
||||
while read line; do
|
||||
autorandr --change --default default
|
||||
done
|
||||
|
|
|
@ -3,7 +3,7 @@ Description=Runs autorandr whenever the lid state changes
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=bash -c "stdbuf -oL libinput debug-events | grep --line-buffered SWITCH_TOGGLE | while read line; do autorandr --batch --change --default default; done"
|
||||
ExecStart=bash -c "stdbuf -oL libinput debug-events | egrep --line-buffered '^ event[0-9]+\s+SWITCH_TOGGLE\s' | while read line; do autorandr --batch --change --default default; done"
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=autorandr
|
||||
|
|
Loading…
Reference in New Issue