From 53179f1ee6a434ac342139de9bf04d0af497d34c Mon Sep 17 00:00:00 2001 From: dabruh <11458706-dabruh@users.noreply.gitlab.com> Date: Wed, 3 Aug 2022 12:20:09 +0200 Subject: [PATCH] Prevent re-locking. --- .local/bin/i3exit | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.local/bin/i3exit b/.local/bin/i3exit index 8a9aee7..c8102e5 100755 --- a/.local/bin/i3exit +++ b/.local/bin/i3exit @@ -9,13 +9,18 @@ LOCK_SCREEN_BLUR=${LOCK_SCREEN_BLUR:-false} LOCK_SCREEN_COLOR=${LOCK_SCREEN_COLOR:-29414f} +I3LOCK_RE="i3lock -(c|i) " _lock() { i3lock -c "$LOCK_SCREEN_COLOR" } _unlock() { - pkill -u "$USER" -f "i3lock -(c|i) " + pkill -u "$USER" -f "$I3LOCK_RE" +} + +is_locked() { + pgrep -u "$USER" -f "$I3LOCK_RE" >/dev/null } lock() { @@ -44,7 +49,7 @@ lock() { case "$1" in lock) - lock + is_locked || lock ;; logout) i3-msg exit