diff --git a/swayidle-lock-screen b/swayidle-lock-screen index c900d8e..88daa63 100755 --- a/swayidle-lock-screen +++ b/swayidle-lock-screen @@ -1,6 +1,12 @@ #!/usr/bin/env zsh +LOCKFILE="${HOME}/.cache/swayidle-lock-screen.lock" + function run { + # ensure multiple instances do not run + mkdir -p "$(dirname "${LOCKFILE}")" + exec 4<>"${LOCKFILE}" + flock -n 4 || exit 0 dunstctl set-paused true swayidle -w -C /dev/null \ timeout 15 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' & @@ -10,6 +16,7 @@ function run { hyprctl dispatch dpms on dunstctl set-paused false fix_eww + flock -u 4 } function fix_eww {