Repository navigation
Conversation
omarchy-launch-screensaver walks the focus across every monitor to find the windows it opened, then hands focus back to the monitor the user was on. omarchy-screensaver used to exit as soon as its focus check failed, which happens a second after launch while that walk is still running, and the idle service read the close as the user dismissing the screensaver, cancelling the pending lock. Give the watch loop a short startup grace window where only a key exits. Once the grace is over, losing focus still closes the screensaver. Fixes omacom#15489
[Medium impact] The change reaches the idle screensaver and its lock handoff. The PR appears safe to merge, with two non-blocking improvements needed in the new test. FindingsSummaryAdds a five-second startup grace to
Reviews (1) · Last reviewed commit: "screensaver: survive the launcher's focu..." · Reviewed by Greptile |
| [[ -f $tmpdir/ttfx-stop ]] || touch "$tmpdir/ttfx-stop" 2>/dev/null || true | ||
| rm -rf "$tmpdir" |
There was a problem hiding this comment.
The pkill stub does nothing, and cleanup removes ttfx-stop immediately after creating it. If the ttfx child misses that brief interval, it keeps waking every 50 milliseconds forever. Repeated test runs can accumulate these children.
Stop and wait for the children before removing the directory, or let the ttfx stub exit immediately since the fake pgrep already keeps the screensaver loop running.
| printf 'x' >&"$keys" | ||
| for (( attempt = 0; attempt < 50; attempt++ )); do | ||
| kill -0 "$saver_pid" 2>/dev/null || break | ||
| sleep 0.1 | ||
| done | ||
| if kill -0 "$saver_pid" 2>/dev/null; then | ||
| fail "a key closes the screensaver even inside the grace window" "$(head -c 400 "$tmpdir/out")" |
There was a problem hiding this comment.
Key check can pass incorrectly
The test sends a key about 2.5 seconds after startup, then allows another five seconds for exit. Because the fake active window remains foot, the screensaver exits on its own when the startup grace ends. This passes the assertion even if keyboard dismissal is broken.
Set activewindow.json to the screensaver class before sending the key so focus loss cannot make this check pass.
|
Read the diff at 485530c against Two things that verification has to settle, noted here so they are visible now:
Waiting on the second opinion, then on a worker run. |
Problem
After the seat goes idle, the screensaver could close itself about a second after launching, and the idle service read that close as the user dismissing the screensaver — cancelling the pending lock. The session then never locked (#15489).
omarchy-launch-screensaverwalks the focus across every monitor to find the windows it just opened, then hands focus back to the monitor the user was on. During that walk — the first seconds after launch — the screensaver window is not focused, andomarchy-screensaverexits as soon as its focus check fails:Fix
Give the watch loop a short startup grace window (5s) where only a key exits. Once the grace is over, losing focus still closes the screensaver, so nothing leaks when a launch fails outright.
Test
New
test/shell.d/screensaver-startup-grace-test.sh(stubbedhyprctl/pgrep/pkill/ttfx, fifo stdin):quattro(exits after ~1s), passes with this change;quattro.Related existing tests pass:
screensaver-workspace-test.sh,idle-test.sh,system-lock-test.sh.Fixes #15489