Skip to content

Close screensaver on mouse move/click. - #16790

Closed
omarchybot wants to merge 7 commits into
quattrofrom
omabot/pr-16549
Closed

omarchybot wants to merge 7 commits into
quattrofrom
omabot/pr-16549

Conversation

@omarchybot

@omarchybot omarchybot commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

The screensaver only closes on a keypress inside its own terminal, or when it loses focus. Moving the mouse, clicking or scrolling over it does nothing, so on a desk the first instinct to wake the machine leaves the screensaver up. Closes #7762.

This dismisses it on any seat input, using the compositor's input notifications rather than anything inside the terminal. A one-millisecond IdleMonitor runs only while a screensaver window is mapped. It ignores inhibitors, so a playing video does not keep a manually started screensaver up. On its first input after arming, it closes the screensaver the same way omarchy-screensaver closes itself, and the screensaver's own exit trap restores the cursor. Hyprland never resumes a zero-timeout notification, hence one millisecond.

Input arms only once a launch is over, so the click or keypress that launched the screensaver, and the launcher's focus walk across monitors, cannot close it while the rest are still opening. omarchy-launch-screensaver reports screensaverLaunching before each monitor and screensaverReady once every window has mapped and focus is back; input arms 500 ms after that. A screensaver that opens outside a launch arms on its own after 500 ms: one that mapped after the launcher stopped waiting for it, or one already up when the shell starts. A launcher killed mid-launch never reports ready, so fifteen seconds without a report ends the launch: each monitor costs the launcher at most its five-second wait, whatever the monitor count.

The service counts screensaver windows from the live toplevel list (ToplevelManager, filtered on the screensaver's app id), not from a set built out of Hyprland's openwindow and closewindow events. The count decides whether activity may cancel a pending lock, so it has to match the windows that exist. A set that missed one close would stay non-empty for good, and a shell started while a screensaver was up would never see it. Wayland reports every close, and a new shell lists the windows already open, so a screensaver started from the menu stays dismissable across idle cycles and shell restarts. That replaces the raw-event handler and the two model helpers that only served it.

test/shell.d/idle-test.sh now runs the real idle service against real screensaver windows: one opened before the service starts and one opened mid-launch. It checks that the count follows them, that input arms for the first on its own, and that it stays unarmed for the second until the launch reports ready. screensaver-workspace-test.sh checks that the launcher reports each monitor before opening its screensaver.

Because any key now dismisses through the compositor, this likely also addresses #15985, where letter keys are lost while ttfx is drawing.

#16519 covers the click case alone, from inside the screensaver script. #7528, #12975, #11746 and #16235 are other approaches to the same problem.

Reviewed by Claude Opus 5.5, with Codex Medium and muse-spark-1.3-contributor High as second opinions. On an Omarchy ISO worker, uinput mouse movement, a click, a scroll and a letter key each dismissed the screensaver, whether it was launched from the menu, launched by idle, or still up across a shell restart. An idle dismissal cancelled the pending lock. A screensaver opened mid-launch stayed up through mouse movement until the launch reported ready. A launch that stopped reporting armed after fifteen seconds. Alacritty, Ghostty, Kitty and foot screensaver windows were each counted on the hidden special workspace. On the base branch the same mouse movement left the screensaver up.

Supersedes #16549 by @erykwieliczko, whose commits this carries unchanged, with the fixes above on top.

erykwieliczko and others added 2 commits October 25, 2026 03:59
Keep window tracking across idle cycles so manually started screensavers remain dismissible.

Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja>
The launcher stops waiting for each window after five seconds and then sends screensaverReady. A terminal that maps later found the arm timer already spent, so the screensaver stayed up through mouse movement until a key was pressed. Restarting the arm timer whenever an unarmed screensaver window opens covers that window too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: muse-spark-1.3-contributor High <noreply@meta.com>
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are addressed and no new actionable issue was found.

Summary

The PR dismisses screensavers on mouse movement, clicks, scrolling, and keys through compositor input notifications.

  • Screensavers close when you use any input after launch.
  • The idle service counts screensaver windows that are actually open.

Both previous findings are addressed.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Report monitor launch] --> B[Pause fallback arming]
  B --> C[Open screensaver window]
  C --> D{More monitors?}
  D -->|Yes| A
  D -->|No| E[Restore focus and report ready]
  E --> F[Wait 500 ms]
  B -->|No report for 15 seconds| F
  F --> G[Arm input dismissal if windows remain]
  G --> H[Seat input closes screensavers]
Loading

Reviews (3) · Last reviewed commit: "Report launch progress from the launcher..." · Reviewed by Greptile

Comment thread shell/plugins/services/idle/Service.qml Resolved
The idle service built its set of screensaver windows from Hyprland's openwindow and closewindow events. Since the set now lives across idle cycles, one missed close would leave it non-empty for good: the 1 ms input monitor would stay on and activity would stop cancelling a pending lock. A shell started while a screensaver was up never saw it at all, so mouse input could not dismiss it.

Reading the count from ToplevelManager instead follows the windows that exist, and Wayland reports every close. That drops the raw-event handler and the two model helpers that only served it. The new runtime test opens a screensaver before the service starts, another after, closes both, and fails on the event-built set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchybot and others added 4 commits October 27, 2026 13:22
Arming whenever a screensaver window opened also armed it while the launcher was still opening screensavers on other monitors: with a terminal slower than 500 ms to map, moving the mouse mid-launch killed the screensavers already up while the launcher went on opening the rest. The launcher now reports when its launch starts, and a window opening arms input only when no launch is in progress -- a late map after screensaverReady, or a screensaver already up when the shell starts. Every screensaver closing clears the flag, so a launcher killed mid-launch cannot leave it set past its windows.

The runtime check moves into idle-test.sh, where the area's tests live, and covers the mid-launch case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A launcher killed mid-launch never sends screensaverReady, so its screensavers stayed unarmed: mouse input could not dismiss them, and launching again exits on finding one already running. The launcher waits at most five seconds per monitor, so after thirty seconds the service treats the launch as finished and arms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: muse-spark-1.3-contributor High <noreply@meta.com>
Thirty seconds from the start of a launch did not cover every real launch: seven monitors whose terminals each take most of the launcher's five-second wait outlast it, and the deadline then armed input mid-launch. Restarting it whenever a screensaver opens during a launch makes it the time since the launch last made progress, which covers any number of monitors; fifteen seconds allows a monitor whose window never maps between two that do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: muse-spark-1.3-contributor High <noreply@meta.com>
Restarting the launch deadline when a screensaver opened assumed at most one monitor in a row would fail to map: two that time out back to back outlast fifteen seconds, and any screensaver-class window from elsewhere could keep a dead launch going. The launcher now reports before each monitor, and the deadline counts from its last report: each monitor costs at most its five-second wait, so fifteen seconds without one means the launcher has stopped, however many monitors there are, and windows the launcher did not open no longer extend it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: muse-spark-1.3-contributor High <noreply@meta.com>
@omarchybot

Copy link
Copy Markdown
Collaborator Author

Reviewed at a9b0a4c. Nothing is left to act on; what remains is the maintainer's call between this and the competing approaches listed in the description.

Since the supersede. Four commits on top of Eryk's and the late-map fix:

  • Live window count. Screensaver windows are now counted from the live toplevel list rather than from Hyprland window events. The count decides whether activity may cancel a pending lock, so a missed close can no longer leave it stuck and lock the session under an active user. A shell started while a screensaver is up now sees it.
  • Launch gate. A window opening during a launch no longer arms input. The launcher reports each monitor and then ready, so mouse movement mid-launch cannot close the screensavers already up while the rest are still opening.
  • Deadline. A launch that stops reporting for 15 s, a killed launcher, ends on its own, so its screensavers still arm.
  • Test placement. The runtime test lives in idle-test.sh, per AGENTS.md.

What ran. Everything below ran on a disposable worker built from the Omarchy ISO, with this branch linked as the running shell and real input from a uinput device:

  • Mouse movement, a click, a scroll and a letter key each dismissed the screensaver, whether it was launched from the menu, launched by idle, or still up across a shell restart. An idle dismissal cancelled the pending lock without locking.
  • A screensaver opened mid-launch stayed up through mouse movement until the launch reported ready. A launch that stopped reporting armed after 15 s. Plugging in a pointer device and a cursor warp did not dismiss.
  • Alacritty, Ghostty, Kitty and foot screensaver windows were each counted on the hidden special workspace.
  • On the base commit, the same mouse movement left the screensaver up.
  • Tests. ./test/cli passes. ./test/shell passes except seven tests (ascii, about-animation, first-run, lock-appear budget, kernel pkexec, platform-setup, runtime-smoke) that fail identically on the base commit 4fa93e9 on the same worker.
  • Mutations. Each new check was run against the change broken on purpose, and went red: the old event-built count, the launch gate removed, the launcher's report hoisted out of its loop, and the deadline disabled.

Second opinion. Codex Medium and muse-spark-1.3-contributor High reviewed every round. The late map, the stale-count path, mid-launch arming, a killed launcher and multi-monitor timing were all theirs or Greptile's, and each is fixed above. One remains noted, not changed: a single monitor iteration can outlast 15 s only if Hyprland takes seconds to answer each of several hyprctl calls in a row. Even then the cost is input arming early, not a lock.

Not covered. Real multi-monitor hardware (simulated with timed windows), Bluetooth input, and whether the hidden cursor comes back (it can't be read through hyprctl).

Waiting on. The maintainer.

@omarchybot

Copy link
Copy Markdown
Collaborator Author

Superseded by #16800, now merged. The screensaver is a native Wayland overlay that dismisses itself on any key, click, scroll or mouse movement, so the terminal-side input monitoring this added is no longer needed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Quattro] Screensaver only exits on a keypress inside its own terminal — global mouse/keyboard activity is explicitly ignored while it's up

2 participants