From 5366a5dc3748524ab8b892cdd1b2e5bd07c009e0 Mon Sep 17 00:00:00 2001 From: Christophe-Marie Duquesne Date: Sun, 3 Nov 2019 23:59:29 +0100 Subject: [PATCH] Adding a systemd script to monitor lid changes --- contrib/systemd/autorandr-lid-listener.service | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 contrib/systemd/autorandr-lid-listener.service diff --git a/contrib/systemd/autorandr-lid-listener.service b/contrib/systemd/autorandr-lid-listener.service new file mode 100644 index 0000000..7e45438 --- /dev/null +++ b/contrib/systemd/autorandr-lid-listener.service @@ -0,0 +1,12 @@ +[Unit] +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" +Restart=always +RestartSec=30 +SyslogIdentifier=autorandr + +[Install] +WantedBy=multi-user.target -- 2.39.2