lock
This commit is contained in:
@@ -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
|
# 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.
|
# 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 b off
|
||||||
|
exec --no-startup-id xset s noblank
|
||||||
exec --no-startup-id xset s 300 300
|
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 xss-lock -- ~/.config/i3/scripts/lock $wallpaper_dir
|
||||||
exec --no-startup-id ~/.config/i3/scripts/dpms-inhibit
|
exec --no-startup-id ~/.config/i3/scripts/dpms-inhibit
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ interval="${1:-5}"
|
|||||||
|
|
||||||
# Single-instance lock: i3 restarts/reloads re-run our autostart exec, so
|
# Single-instance lock: i3 restarts/reloads re-run our autostart exec, so
|
||||||
# without this, stray duplicate loops accumulate and race each other's state.
|
# 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
|
flock -n 9 || exit 0
|
||||||
|
|
||||||
has_fullscreen() {
|
has_fullscreen() {
|
||||||
@@ -39,6 +40,8 @@ EOF
|
|||||||
|
|
||||||
inhibited=0
|
inhibited=0
|
||||||
while true; do
|
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
|
if has_fullscreen; then
|
||||||
xset s off
|
xset s off
|
||||||
xset -dpms
|
xset -dpms
|
||||||
@@ -46,7 +49,7 @@ while true; do
|
|||||||
else
|
else
|
||||||
if [ "$inhibited" -eq 1 ]; then
|
if [ "$inhibited" -eq 1 ]; then
|
||||||
xset s 300 300
|
xset s 300 300
|
||||||
xset dpms 300 600 900
|
xset dpms 0 0 900
|
||||||
inhibited=0
|
inhibited=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
+2
-3
@@ -1,5 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Idle-blanking during fullscreen is suppressed by dpms-inhibit, so this
|
# Invoked by xss-lock on idle (after 5min) and before suspend. Idle locking
|
||||||
# script (invoked by xss-lock) is only ever triggered for a real pre-suspend
|
# during fullscreen is suppressed by dpms-inhibit.
|
||||||
# lock — always lock, regardless of fullscreen state.
|
|
||||||
exec ~/.config/i3/scripts/lock-now "$1"
|
exec ~/.config/i3/scripts/lock-now "$1"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
wall_dir="${1:?wallpaper directory required}"
|
wall_dir="${1:?wallpaper directory required}"
|
||||||
img=$(find "$wall_dir" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n1)
|
img=$(find "$wall_dir" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n1)
|
||||||
if [ -n "$img" ]; then
|
if [ -n "$img" ]; then
|
||||||
exec swaylock -i "$img"
|
exec swaylock -f -i "$img"
|
||||||
else
|
else
|
||||||
exec swaylock
|
exec swaylock -f
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user