Bugfix screensaver not exiting (#1687)

* exit if screensaver not in focus

* Extract explaining function

* Consistent function style

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
Manuel
2025-09-15 22:46:15 +02:00
committed by GitHub
parent 2719db01f9
commit facae82630

View File

@@ -1,6 +1,10 @@
#!/bin/bash
function exit_screensaver {
screensaver_in_focus() {
hyprctl activewindow -j | jq -e '.class == "Screensaver"' >/dev/null 2>&1
}
exit_screensaver() {
hyprctl keyword cursor:invisible false
pkill -x tte 2>/dev/null
pkill -f "alacritty --class Screensaver" 2>/dev/null
@@ -18,7 +22,7 @@ while true; do
"$effect" &
while pgrep -x tte >/dev/null; do
if read -n 1 -t 3; then
if read -n 1 -t 3 || ! screensaver_in_focus; then
exit_screensaver
fi
done