2020-09-30 03:58:30 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# this is a simple replacmeent for an ACPI handler script
|
|
|
|
# put it somewhere accessible for single-user mode and make a runit script for it
|
|
|
|
# copyleft 2020 Derek Stevens <drkste@zoho.com>
|
|
|
|
# MIT License -- do whatever you want
|
|
|
|
|
|
|
|
acpi_listen | {
|
|
|
|
while read event; do
|
|
|
|
|
|
|
|
# if no external monitor
|
|
|
|
# if [ ! -z "$(xrandr | grep HDMI | grep disconnected)" ]; then
|
|
|
|
|
|
|
|
# if AC is offline
|
|
|
|
if [ ! -z "$(acpi -a | grep off-line)" ]; then
|
|
|
|
|
|
|
|
if [ "${event}" = "button/lid LID close" ]; then
|
2020-11-10 23:14:45 +00:00
|
|
|
slock & sleep 1
|
2020-09-30 03:58:30 +00:00
|
|
|
zzz
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# fi
|
|
|
|
done
|
|
|
|
}
|