Make safeeyes propery reset after sleep
This commit is contained in:
8
reset-safeeyes-time
Executable file
8
reset-safeeyes-time
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
local state
|
||||||
|
state="$(safeeyes --status)"
|
||||||
|
if [[ "${state}" = Next* ]]; then
|
||||||
|
safeeyes --disable
|
||||||
|
safeeyes --enable
|
||||||
|
fi
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
LOCKFILE="${HOME}/.cache/swayidle-lock-screen.lock"
|
LOCKFILE="${HOME}/.cache/swayidle-lock-screen.lock"
|
||||||
ENABLE_DISPLAYS="${HOME}/scripts/enable-displays-for-sleep"
|
ENABLE_DISPLAYS="${HOME}/scripts/enable-displays-for-sleep"
|
||||||
|
RESET_SAFEEYES="${HOME}/scripts/reset-safeeyes-time"
|
||||||
|
|
||||||
function has-rootful-xwayland-p {
|
function has-rootful-xwayland-p {
|
||||||
for pid in $(pgrep Xwayland); do
|
for pid in $(pgrep Xwayland); do
|
||||||
@@ -32,11 +33,14 @@ function run {
|
|||||||
ignored_args+=(-i "${(q)name}")
|
ignored_args+=(-i "${(q)name}")
|
||||||
done
|
done
|
||||||
swayidle -w -C /dev/null \
|
swayidle -w -C /dev/null \
|
||||||
|
before-sleep "${(q)RESET_SAFEEYES}" \
|
||||||
timeout 15 "${(q)ENABLE_DISPLAYS} -d ${ignored_args}" \
|
timeout 15 "${(q)ENABLE_DISPLAYS} -d ${ignored_args}" \
|
||||||
resume "${(q)ENABLE_DISPLAYS} {$ignored_args}" &
|
resume "${(q)ENABLE_DISPLAYS} {$ignored_args}" &
|
||||||
swayidle_pid="${!}"
|
swayidle_pid="${!}"
|
||||||
else
|
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="${!}"
|
swayidle_pid="${!}"
|
||||||
fi
|
fi
|
||||||
swaylock ${empty_flag} ${img_flags}
|
swaylock ${empty_flag} ${img_flags}
|
||||||
|
|||||||
Reference in New Issue
Block a user