#!/bin/sh
set -xe
if pgrep xidle >/dev/null; then
pkill -USR1 xidle &
elif command -v xsecurelock >/dev/null; then
xsecurelock &
fi
if [ ! "${1}" = "-s" ]; then
exit 0
fi
sleep 1
if command -v systemctl; then
systemctl suspend
elif command -v zzz; then
! doas -n zzz && zzz
fi