Prevent re-locking.

This commit is contained in:
dabruh 2022-08-03 12:20:09 +02:00
parent 7881471854
commit 53179f1ee6
1 changed files with 7 additions and 2 deletions

View File

@ -9,13 +9,18 @@
LOCK_SCREEN_BLUR=${LOCK_SCREEN_BLUR:-false} LOCK_SCREEN_BLUR=${LOCK_SCREEN_BLUR:-false}
LOCK_SCREEN_COLOR=${LOCK_SCREEN_COLOR:-29414f} LOCK_SCREEN_COLOR=${LOCK_SCREEN_COLOR:-29414f}
I3LOCK_RE="i3lock -(c|i) "
_lock() { _lock() {
i3lock -c "$LOCK_SCREEN_COLOR" i3lock -c "$LOCK_SCREEN_COLOR"
} }
_unlock() { _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() { lock() {
@ -44,7 +49,7 @@ lock() {
case "$1" in case "$1" in
lock) lock)
lock is_locked || lock
;; ;;
logout) logout)
i3-msg exit i3-msg exit