Make safeeyes propery reset after sleep

This commit is contained in:
2025-12-14 09:01:20 -08:00
parent 51bebbabf6
commit a8320c22f4
2 changed files with 13 additions and 1 deletions

8
reset-safeeyes-time Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env zsh
local state
state="$(safeeyes --status)"
if [[ "${state}" = Next* ]]; then
safeeyes --disable
safeeyes --enable
fi

View File

@ -2,6 +2,7 @@
LOCKFILE="${HOME}/.cache/swayidle-lock-screen.lock"
ENABLE_DISPLAYS="${HOME}/scripts/enable-displays-for-sleep"
RESET_SAFEEYES="${HOME}/scripts/reset-safeeyes-time"
function has-rootful-xwayland-p {
for pid in $(pgrep Xwayland); do
@ -32,11 +33,14 @@ function run {
ignored_args+=(-i "${(q)name}")
done
swayidle -w -C /dev/null \
before-sleep "${(q)RESET_SAFEEYES}" \
timeout 15 "${(q)ENABLE_DISPLAYS} -d ${ignored_args}" \
resume "${(q)ENABLE_DISPLAYS} {$ignored_args}" &
swayidle_pid="${!}"
else
swayidle -w -C /dev/null timeout 15 "systemctl suspend" &
swayidle -w -C /dev/null \
before-sleep "${(q)RESET_SAFEEYES}" \
timeout 15 "systemctl suspend" &
swayidle_pid="${!}"
fi
swaylock ${empty_flag} ${img_flags}