Skip to content

Only treat lost focus as screensaver dismissal after it has held focus - #13637

Closed
AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:cursor/fix-screensaver-focus-e0d3
Closed

AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:cursor/fix-screensaver-focus-e0d3

Conversation

@AnPod

@AnPod AnPod commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #13265

With the clock calendar open, hyprctl activewindow never reported the screensaver (layer-shell), so it dismissed itself after ~1s as a small square.

Change

  • Latch first focus before counting its absence as dismissal

Test plan

  • Open the clock calendar, then start the screensaver; it should stay up until real dismissal

Fixes #12225

hyprctl activewindow only reports toplevels, so an open layer-shell panel
(clock calendar) leaves the prior terminal active and the screensaver
never acquires focus. Latch first focus before counting its absence as
dismissal (omacom#13265).

Co-authored-by: AnPod <AnPod@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/fix-screensaver-focus-e0d3 branch from b7338ce to 93b3906 Compare September 29, 2026 21:14
@omarchybot omarchybot added the bug Something isn't working label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for the fix. I read it against quattro and the other open pull requests for #13265, and this is waiting on the maintainer to choose between them rather than on you.

The change to bin/omarchy-screensaver here is line for line the same code as #7102, which is older and targets quattro too. Both add the was_focused latch, move the focus check ahead of the blocking read, and count lost focus as a dismissal only once the screensaver has held focus. The only differences are the comment above was_focused and test/shell.d/screensaver-focus-test.sh, which greps the script for that text rather than running it. #7102 was already reproduced on a disposable worker against quattro: with the calendar or the menu open, the screensaver stays up instead of quitting after about a second. So I did not spend a worker re-running the same code here. Only one of the two can land, and the choice between them is the maintainer's.

What I checked in the source applies to both: if the screensaver never gets focus at all, it stays up. While a screensaver window exists, shell/plugins/services/idle/Service.qml:166 ignores activity, and the lock timer at :271 still fires. So someone who comes back and works in another window without ever focusing the screensaver is locked at the original deadline. Closing the menu does hand focus to the screensaver, so the ordinary case is fine. The case that is not covered is focus moving elsewhere before the first check.

Other open fixes for the same bug: #13475 closes open panels before launch and ignores focus for five seconds; #12258 keeps the latch and adds an input monitor to the idle service; #13784 makes the screensaver fullscreen and focused while a panel holds focus, which complements any of these.

Reviewed by Claude Opus 5.5, with a second opinion from Codex Medium. Codex agreed that this and #7102 are the same executable change and named the lock-while-working case above. Its independence is not guaranteed. Asked which of the four to bring forward, it preferred #13475's approach of releasing the panel's focus before the screensaver maps. An earlier Codex review on #7102 preferred #7102 over #13475, so the two models do not settle it between them.

AnPod commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by the older #7102, which makes the same change.

@AnPod AnPod closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

3 participants