24 lines
564 B
Bash
24 lines
564 B
Bash
|
#!/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
|
||
|
zzz
|
||
|
fi
|
||
|
fi
|
||
|
# fi
|
||
|
done
|
||
|
}
|