Repository navigation
Only treat lost focus as a dismissal once the screensaver has held focus - #7102
omarchybot wants to merge 2 commits into
Conversation
The screensaver's watchdog exits when `hyprctl activewindow` stops reporting the screensaver class, which is meant to catch the user clicking away onto another window. `hyprctl activewindow` only ever reports toplevels, though, so it cannot see a layer surface. When a bar panel is open it holds layer-shell keyboard focus and the newly mapped screensaver never becomes the active toplevel at all -- the panel leaves the previously focused terminal sitting there as `activewindow`. The check then reads "never acquired focus" as "the user dismissed me" and the screensaver kills itself on the first tick of the loop, roughly one second after it appeared. The damage is not just the flash of a window. The idle service watches for the screensaver's window closing and treats it as activity: `handleScreensaverWindowClosed` cancels the idle cycle with `screensaver-dismissed`, which stops the pending lock timer. Walking away with the battery dropdown open therefore leaves the machine idle and unlocked. Latch a flag the first time the screensaver is genuinely focused and only count the absence of focus as a dismissal after that. Sampling focus before the blocking read rather than after it means a normal launch latches immediately, so clicking away is still detected within the same second as before. This leaves the other half of #6917 alone: with a panel open the fullscreen window rule does not apply either and the screensaver draws as a floating 700x500 window. That happens inside the compositor -- `default/hypr/apps/system.lua` registers the rule through Hyprland's own `hl.window_rule` and Omarchy has no other fullscreen path -- so it is not fixable here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
The latch fixes the panel case, but the same watchdog has a second trigger it does not cover: a multi-monitor launch, where the screensaver does hold focus first and then loses it while
Captured from Hyprland's event stream on a three-output session, launched from the menu entry ( Whether it fires depends on how long the launch takes relative to the 1s
The consequence is the one described in the second half of #6917: A complement that would close this: don't enforce the focus check until every output has a screensaver window — compare Fully aware #7193 makes this moot if it lands, since one exclusive overlay per output removes both the terminal spawn sequence and the Environment
|
The latch watches for any screensaver-class window being active, so the comment says it has been seen with focus rather than that it held it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Re-checked against current
With the panel case on this PR, closing the menu hands focus to the screensaver, which latches it, and clicking away then dismisses it as before. Clicking away with no panel open still dismisses within a second. I pushed one commit, c9eef00, that shortens the comment above @EduardsSk, your multi-monitor trigger is real in Residual: if focus moves somewhere else before the first sample (right after #13475 fixes the same bug by closing open panels at launch and ignoring focus for five seconds. It covers only panels the shell knows how to close. If the focus-holding surface outlives the five seconds, the original failure comes back. It closes whatever panel the user had open, and it carries unrelated Windows VM permission changes. #6813 keeps the Second opinion: Codex Medium reviewed the change in two rounds and found nothing open on this head. Independence is not guaranteed. It raised the startup window above, which it judged a residual to name rather than a blocker, and suggested the comment wording. Asked separately to choose between this and #13475, it picked this one for the reasons above. This is waiting on the maintainer. |
|
This no longer applies to I checked the reported failure on a disposable worker running Codex Medium reviewed the PR diff, fdbe182 and the current idle service. It agreed that nothing in this PR still applies. It also pointed out that the idle service still cancels the lock cycle when the screensaver exits while the idle monitor reports activity ( This is waiting on the maintainer, with a recommendation to close it as superseded by the native screensaver. The three linked issues would then stay open until someone confirms them against the native screensaver. |
The screensaver's watchdog exits when
hyprctl activewindowstops reporting the screensaver's class, which is meant to catch the user clicking away onto another window.hyprctl activewindowonly ever reports toplevels, so it cannot see a layer surface. When a bar panel is open it holds layer-shell keyboard focus (shell/Ui/KeyboardPanel.qml:98) and the newly mapped screensaver never becomes the active toplevel at all -- the panel leaves the previously focused terminal sitting there asactivewindow.bin/omarchy-screensaver:44then reads "never acquired focus" as "the user dismissed me" and the screensaver kills itself on the first tick of the loop, about one second after it appeared. That matches the lifetimes the reporter measured across five failures (1.046, 1.044, 1.228, 1.235, 1.235s): the 1.000sread -n1 -t 1timeout plus thewait_for_terminal_resizeprefix.The damage is not just the flash of a window. The idle service watches for the screensaver's window closing and treats it as activity:
handleScreensaverWindowClosedcancels the idle cycle withscreensaver-dismissed(shell/plugins/services/idle/Service.qml:138), andcancelIdleCyclestops the pending lock timer. Leaving the battery dropdown open and walking away therefore leaves the machine idle and unlocked.This latches a flag the first time the screensaver is genuinely focused, and only counts the absence of focus as a dismissal after that. Sampling focus before the blocking read rather than after it means a normal launch latches immediately, so clicking away is still detected within the same second as before.
This deliberately fixes only half of #6917. With a panel open the
fullscreenwindow rule also fails to apply and the screensaver draws as a floating 700x500 window.default/hypr/apps/system.lua:35registers that rule through Hyprland's ownhl.window_rule(via the thin wrapper atdefault/hypr/helpers.lua:142) and Omarchy has no other fullscreen path, so the failure is inside the compositor and not fixable here. What is left after this change is a screensaver that stays up, keeps the lock timer armed, and locks on schedule -- but is still a small floating box on that cycle. Making it go fullscreen regardless, or closing open panels before launching, is a call for you rather than a defect to correct.Not a duplicate of #6995, which needs a lock already in flight, launches a second screensaver into it, and ends in a ttfx
SIGABRTwith a core dump. This one needs no lock at all and leaves no core dump.Touches the same loop as the open #6813, which keeps the
read -n1 -t 1 || ! screensaver_in_focuscondition verbatim and so does not fix this; whichever lands second will need a small rebase.Fixes #6917
Fixes #13265
Fixes #8114