Skip to content

Dismiss the screensaver on any input, not just a keypress - #7780

Closed
husamemadH wants to merge 1 commit into
omacom:quattrofrom
husamemadH:fix-screensaver-pointer-dismiss
Closed

husamemadH wants to merge 1 commit into
omacom:quattrofrom
husamemadH:fix-screensaver-pointer-dismiss

Conversation

@husamemadH

@husamemadH husamemadH commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7762.

Once the screensaver is up, moving the mouse does nothing — it only goes away on a keypress delivered to its own terminal. Pre-Quattro, hypridle's on-resume dismissed it on any global input.

Why the main idle monitor cannot see the input

The screensaver focusing its own window registers as activity, so IdleMonitor.isIdle flips back to false a fraction of a second after launch and then never changes for the rest of the display. onIsIdleChanged never fires again, so handleActiveSignal() is never reached, and the screensaverWindowCount > 0 guard inside it is not what suppresses the dismissal — the signal simply never arrives.

Traced on an affected machine (polling the idle service's own IPC status; the key includes lastEventAt, so a repeated event would still show):

17:48:28.948 | isIdle=true  inCycle=true ssWindows=0 | process-start: screensaver
17:48:29.240 | isIdle=false inCycle=true ssWindows=1 | process-exit: screensaver
   ... ~12s of continuous mouse movement: no events at all ...
17:48:41.211 | isIdle=false inCycle=false ssWindows=0 | process-exit: wake

Two cycles in the same run, with the self-inflicted flip landing at 292ms and 295ms after launch. So narrowing that guard would edit unreachable code.

cancelIdleCycle() is also not a teardown: it stops timers and runs omarchy-system-wake, leaving the screensaver window on screen.

The fix

A second IdleMonitor, enabled only while a screensaver window exists. It arms once input has gone quiet — which absorbs the launch activity without needing a grace timer — and the next activity dismisses the screensaver with the same pkill that omarchy-system-lock already uses. The existing closewindow → handleScreensaverWindowClosed() path then cancels the pending lock and wakes the display, unchanged.

Because ext-idle-notify is compositor-side, this covers keyboard, pointer motion, clicks, touch, and bluetooth devices without the terminal being involved. Manually launched screensavers (omarchy-launch-screensaver force) become dismissable the same way, since window tracking is driven by Hyprland events rather than the idle cycle.

The arm/dismiss decision is a pure function in IdleModel.js, covered by test/shell.d/idle-test.sh.

Verified in the running UI

Same machine, patched service loaded via omarchy plugin clone omarchy.idle, three cycles:

17:53:00.555 | isIdle=true  ssWindows=0 armed=false | process-start: screensaver
17:53:00.850 | isIdle=false ssWindows=1 armed=false | process-exit: screensaver     <- 295ms blip, ignored
17:53:01.712 | isIdle=false ssWindows=1 armed=true  | screensaver-dismiss-armed
17:53:06.283 | isIdle=false ssWindows=1 armed=false | process-start: dismiss pkill -f '[o]rg.omarchy.screensaver'
17:53:06.574 | isIdle=false ssWindows=0 armed=false | process-exit: wake

Mouse movement dismisses it immediately; teardown measured at 172ms window-close latency in a 50ms-resolution trace. Lock timing is unaffected — the dismissal monitor is disabled whenever no screensaver window is on screen, and lockSystem() resets it.

Terminal: foot. Hardware: Intel UHD 630 + RTX 2080 Mobile, wired mouse.

Related

Tests

./test/shell — 2301 assertions pass, 4 of them new; 182 of 185 test files pass. The 3 failing files (config-test.sh, snapper-test.sh, unowned-system-paths-test.sh) all fail on the same missing omarchy-pkgs sibling checkout on my machine (omarchy-pkgs checkout found/available for ...) and reproduce identically on a clean tree. ./test/cli passes.

The main idle monitor reports activity once while the screensaver maps its
own window and then stays active for as long as the screensaver is up, so
it never signals again and cannot see the input that should dismiss it.
Only the screensaver's own read -n1 loop could, and that needs a byte on
stdin while the terminal holds focus.

Arm a second idle monitor while a screensaver window is on screen. It arms
once input goes quiet, so the launch activity is ignored, and the next
input from any device the compositor knows about tears the screensaver
down.
Copilot AI balanced review requested due to automatic review settings August 22, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds compositor-wide input detection to dismiss visible screensavers after launch activity settles.

Changes:

  • Adds a dedicated dismissal IdleMonitor.
  • Adds a pure dismissal-state helper and tests.
  • Exposes dismissal state in idle-service status output.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
shell/plugins/services/idle/Service.qml Tracks, arms, and dismisses visible screensavers.
shell/plugins/services/idle/IdleModel.js Implements dismissal-state decisions.
test/shell.d/idle-test.sh Tests dismissal-state transitions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


IdleMonitor {
id: screensaverDismissMonitor
enabled: root.idleEnabled && root.screensaverWindowCount > 0
IdleMonitor {
id: screensaverDismissMonitor
enabled: root.idleEnabled && root.screensaverWindowCount > 0
timeout: root.screensaverDismissSettleSeconds
@ClGratton

Copy link
Copy Markdown

Tested successfully on Omarchy 4.0.1 with Hyprland 0.56.2, foot 1.27.0, and two active outputs. The compositor-side IdleMonitor correctly dismisses the screensaver for pointer and keyboard activity, but two lifecycle guards are required for reliable composition.

Arming must wait until the sequential multi-output launcher has completed. Enabling after the first tracked window lets the monitor settle before the second output maps, so the second mapping can be mistaken for user input. The verified local service gates arming on launch completion as well as screensaverWindowCount > 0. It also targets the screensaver supervisor for teardown, matching the lifecycle direction in #6813.

The dismissal callback must also reject active-state changes after the idle cycle enters locking. Disabling the monitor at the lock deadline can emit an active-state signal; treating that signal as input tears the screensaver down before #9632's concealed lock handoff is secure and briefly exposes the desktop. The verified guard is:

function handleScreensaverDismissSignal() {
  if (!root.idledThisCycle || !root.screensaverStartedThisCycle) return

  var action = IdleModel.screensaverDismissAction(
    root.screensaverDismissArmed,
    screensaverDismissMonitor.isIdle,
    root.screensaverWindowCount > 0)
  // existing handling
}

With both guards, two screensaver windows mapped, compositor input dismissed them cleanly, and the later idle-lock transition reached genuine standby without a password or desktop flash.

@bjarneo

bjarneo commented Sep 21, 2026

Copy link
Copy Markdown
Member

Automated duplication check: this pull request looks similar to #7528, which covers the same screensaver input dismiss. I keep that one open and close this one to consolidate review.

If you feel this is the wrong decision, please open the PR again with a note on the difference.

@bjarneo bjarneo closed this Sep 21, 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

4 participants