This commit is contained in:
nnduc
2026-09-25 17:03:27 +07:00
parent 05e604fe27
commit 37b16c4e7c
4 changed files with 13 additions and 9 deletions
+5 -2
View File
@@ -6,7 +6,8 @@ interval="${1:-5}"
# Single-instance lock: i3 restarts/reloads re-run our autostart exec, so
# without this, stray duplicate loops accumulate and race each other's state.
exec 9>"/tmp/.dpms-inhibit-$(id -u).lock"
# Per session, so a loop lingering from a logged-out session can't block this one.
exec 9>"/tmp/.dpms-inhibit-$(id -u)-${XDG_SESSION_ID:-0}.lock"
flock -n 9 || exit 0
has_fullscreen() {
@@ -39,6 +40,8 @@ EOF
inhibited=0
while true; do
# our i3 is gone (logged out): don't linger into the next session
i3-msg -t get_version >/dev/null 2>&1 || exit 0
if has_fullscreen; then
xset s off
xset -dpms
@@ -46,7 +49,7 @@ while true; do
else
if [ "$inhibited" -eq 1 ]; then
xset s 300 300
xset dpms 300 600 900
xset dpms 0 0 900
inhibited=0
fi
fi