summaryrefslogtreecommitdiff
path: root/config/xss-lock/tranfer-sleep-lock-slock-dvs.sh
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2024-02-27 11:58:23 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2024-02-27 11:58:23 -0800
commit893e9748cf241a496726c4fe0bb52c0996be3909 (patch)
tree6f9017130d8f9aea8afeb06af7c5f11794058ba0 /config/xss-lock/tranfer-sleep-lock-slock-dvs.sh
parent5ff26c192ae1d0786790390cfae7759616bbe35f (diff)
downloaddotfiles-master.tar.gz
dotfiles-master.tar.xz
session locking using xss-lock and custom fork of slockHEADmaster
Diffstat (limited to 'config/xss-lock/tranfer-sleep-lock-slock-dvs.sh')
-rwxr-xr-xconfig/xss-lock/tranfer-sleep-lock-slock-dvs.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/config/xss-lock/tranfer-sleep-lock-slock-dvs.sh b/config/xss-lock/tranfer-sleep-lock-slock-dvs.sh
new file mode 100755
index 0000000..1cb3fed
--- /dev/null
+++ b/config/xss-lock/tranfer-sleep-lock-slock-dvs.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+if [[ -e "/dev/fd/${XSS_SLEEP_LOCK_FD:--1}" ]]; then
+ pid="$(slock -kfp {XSS_SLEEP_LOCK_FD}<&-)"
+ trap "kill ${pid}" TERM INT
+ exec {XSS_SLEEP_LOCK_FD}<&-
+
+ waitpid "${pid}" &
+ wait
+else
+ trap 'kill %%' TERM INT
+ slock -k &
+
+ wait
+fi