summaryrefslogtreecommitdiffstats
path: root/.bin/ag-lock
diff options
context:
space:
mode:
Diffstat (limited to '.bin/ag-lock')
-rwxr-xr-x.bin/ag-lock21
1 files changed, 21 insertions, 0 deletions
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
remember that computers suck.