summaryrefslogtreecommitdiffstats
path: root/screen-locker.sh
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2024-10-14 21:37:35 +0200
committerFlorian Pritz <bluewind@xinu.at>2024-10-14 21:54:03 +0200
commit7eac578bab0fa901975fca3bacac61c904cf480c (patch)
treee456efab8f3660c8d9a86689610399f8f8b86e27 /screen-locker.sh
parent25ef852543815f8839dda5247c2651f70e597143 (diff)
downloadbin-7eac578bab0fa901975fca3bacac61c904cf480c.tar.gz
bin-7eac578bab0fa901975fca3bacac61c904cf480c.tar.xz
screen-locker.sh: Add lock to prevent multiple instances
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'screen-locker.sh')
-rwxr-xr-xscreen-locker.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/screen-locker.sh b/screen-locker.sh
index 51b6110..b1fb594 100755
--- a/screen-locker.sh
+++ b/screen-locker.sh
@@ -1,5 +1,12 @@
#!/bin/bash
+lock="$HOME/.screen-locker.lck"
+exec 9>"${lock}"
+if ! flock -n 9; then
+ logger "screen locker lock already locked"
+ exit
+fi
+
if pidof i3lock &> /dev/null; then exit 1; fi
revert() {