From 0f08d04698c814955116b6bae50752e64b774d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Thu, 23 Dec 2021 18:28:03 +0000 Subject: Thu Dec 23 06:28:03 PM UTC 2021 --- .bin/ag-lock | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 .bin/ag-lock (limited to '.bin/ag-lock') diff --git a/.bin/ag-lock b/.bin/ag-lock new file mode 100755 index 0000000..e340245 --- /dev/null +++ b/.bin/ag-lock @@ -0,0 +1,21 @@ +#!/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 -- cgit v1.2.3