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
+4 -2
View File
@@ -30,10 +30,12 @@ exec --no-startup-id dex --autostart --environment i3
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use systemctl lock-session to lock your screen.
# burn-in prevention: blank after 5min, DPMS off after 10min, skip lock if fullscreen
# idle: lock after 5min (xss-lock -> scripts/lock), DPMS off after 15min;
# dpms-inhibit skips all of it while a fullscreen window is visible
exec --no-startup-id xset b off
exec --no-startup-id xset s noblank
exec --no-startup-id xset s 300 300
exec --no-startup-id xset dpms 300 600 900
exec --no-startup-id xset dpms 0 0 900
exec --no-startup-id xss-lock -- ~/.config/i3/scripts/lock $wallpaper_dir
exec --no-startup-id ~/.config/i3/scripts/dpms-inhibit
+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
+2 -3
View File
@@ -1,5 +1,4 @@
#!/bin/bash
# Idle-blanking during fullscreen is suppressed by dpms-inhibit, so this
# script (invoked by xss-lock) is only ever triggered for a real pre-suspend
# lock — always lock, regardless of fullscreen state.
# Invoked by xss-lock on idle (after 5min) and before suspend. Idle locking
# during fullscreen is suppressed by dpms-inhibit.
exec ~/.config/i3/scripts/lock-now "$1"
+2 -2
View File
@@ -2,7 +2,7 @@
wall_dir="${1:?wallpaper directory required}"
img=$(find "$wall_dir" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n1)
if [ -n "$img" ]; then
exec swaylock -i "$img"
exec swaylock -f -i "$img"
else
exec swaylock
exec swaylock -f
fi