all repos — zenUtils @ f2ab754729dab2a4328954ef8348c1526b871e99

misc utilities for computing zen

sleepy.sh (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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
          slock & sleep 1
          zzz
        fi
      fi
    # fi
  done
}