Skip to content

Close open bar panels while the screensaver is up - #11239

Open
ninepointlabs wants to merge 3 commits into
omacom:quattrofrom
ninepointlabs:hide-bar-panels-during-screensaver
Open

ninepointlabs wants to merge 3 commits into
omacom:quattrofrom
ninepointlabs:hide-bar-panels-during-screensaver

Conversation

@ninepointlabs

Copy link
Copy Markdown

Fixes #11234.

A bar panel left open when the session goes idle is a layer-shell surface anchored to the bar, so the compositor draws it above the fullscreen screensaver. Whatever the widget was showing (calendar, mail, display settings) stays on a screen meant to conceal the session, and the panel keeps its keyboard focus grab.

Change

  • Bar.qml watches the enabled idle service's screensaverWindowCount, the same signal Background.qml already uses. When a screensaver window appears, it closes the active popout.
  • The idle service is resolved through pluginRegistry.resolveEnabledId("omarchy.idle"), so a user-cloned idle service still counts.
  • Closing goes through Bar.activePopout, the coordinator both built-in and third-party plugin panels register with. Plugin panels are covered without naming any ids, and closing (rather than hiding) releases the panel's focus grab.

Verification

  • test/shell.d/bar-test.sh passes, including 3 new assertions: the bar follows the enabled (or cloned) idle service, an open panel closes when the screensaver is active, and closing routes through whichever owner registered the popout.
  • In the running UI (omarchy dev link on this branch, two monitors), I triggered omarchy-launch-screensaver force with a panel open:
    • Built-in omarchy.monitor (Display) panel: closed when the screensaver appeared and stayed closed after it exited.
    • Third-party plugin panel (ninepointlabs.fastmail-calendar): same result.
    • No QML errors in the shell log.

Known gap

Replacement third-party bars get a service-less shell facade, so they can't resolve the idle service themselves. The guard makes that a no-op rather than an error, but those bars would need their own handling.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GyYBpCZqLPWr9Ja1VgQnte

A panel left open when the session goes idle is a layer-shell surface
anchored to the bar, so the compositor draws it above the fullscreen
screensaver and leaves whatever the widget was showing on a screen meant
to conceal the session.

Follow the same approach as notifications: watch the enabled idle
service for a live screensaver window, resolved through the plugin
registry so a user-cloned idle service still applies, and close the
active popout when one appears.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F5uBhePbm7S8s5ogP5RT1V
Copilot AI lite review requested due to automatic review settings September 10, 2026 22:19

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.

🟡 Changes recommended

Unresolved critical and moderate findings affect screensaver handling, service resolution, and runtime test coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Closes #11234 by closing open bar panels when the screensaver appears, preventing sensitive content from remaining visible.

Changes:

  • Resolves the enabled idle service, including cloned services.
  • Closes active popouts through the bar coordinator.
  • Adds shell-test assertions for screensaver and popout behavior.
File summaries
File Summary and findings
shell/plugins/bar/Bar.qml Adds screensaver monitoring and popout closure. Findings: 1 critical (1 vote) regarding popouts opened while the screensaver is already active; 2 moderate (1 vote each) regarding asynchronous service binding and missing registry revision dependency.
test/shell.d/bar-test.sh Adds regression assertions. Finding: 1 moderate (1 vote) because the tests are source-based rather than runtime QML assertions.
Review details

Suppressed comments (4)

shell/plugins/bar/Bar.qml:39

  • shell.serviceFor() is evaluated without first reading shell.services, but _services is populated asynchronously by _syncServices(). The shell explicitly exposes services as the binding dependency (and Background.qml uses the shell.services ? ... pattern); without that dependency this can remain null if the bar evaluates before the idle service is registered, so screensaverWindowCount is never observed and the panel stays open. Read shell.services in this guard, as Background.qml does.
  readonly property var idleService: shell && typeof shell.serviceFor === "function"
    ? shell.serviceFor(idleServiceId) : null

shell/plugins/bar/Bar.qml:572

  • requestPopout() supports an owner with closeForPopoutSwitch() when it does not expose close(), but this screensaver path only invokes close. Such a registered plugin owner is merely released from activePopout; its popup remains open and can keep its focus grab. Mirror the fallback used in requestPopout() before releasing the owner.
    if ("close" in activePopout) activePopout.close()

shell/plugins/bar/Bar.qml:37

  • This binding does not read pluginRegistry.registryRevision, even though enabling/disabling a clone changes the shell config and increments that revision without changing installedPlugins. After switching from the built-in idle service to a clone, idleServiceId can remain cached as omarchy.idle, leaving idleService null and preventing panels from being closed; read the revision before resolving, as the other registry-derived bindings do.
  readonly property string idleServiceId: shell && shell.pluginRegistry
    ? shell.pluginRegistry.resolveEnabledId("omarchy.idle")
    : "omarchy.idle"

test/shell.d/bar-test.sh:501

  • These assertions only grep for source text; they never instantiate Bar.qml or drive an idle service's screensaverWindowCount. They would pass even if the service binding failed at runtime or the close call did not release the panel, so this security-sensitive behavior needs a runtime QML assertion, including the cloned-service path, similar to the existing bar widget contract tests.
if ! rg -q 'onScreensaverActiveChanged: if \(screensaverActive\) closeActivePopout\(\)' \
  "$ROOT/shell/plugins/bar/Bar.qml"; then
  fail "an open bar panel closes while the screensaver is active"
fi
pass "an open bar panel closes while the screensaver is active"
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

Comment thread shell/plugins/bar/Bar.qml
readonly property var idleService: shell && typeof shell.serviceFor === "function"
? shell.serviceFor(idleServiceId) : null
readonly property bool screensaverActive: !!idleService && idleService.screensaverWindowCount > 0
onScreensaverActiveChanged: if (screensaverActive) closeActivePopout()
Also re-resolve the idle service when a clone is enabled or the service
registers late, and fall back to closeForPopoutSwitch for popout owners
without close().

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aa8yQ5mT7eh2sDtwuQBmzz
@ninepointlabs

Copy link
Copy Markdown
Author

Addressed the review in 7ecea86:

  • Panel opened while the screensaver is already up: onActivePopoutChanged now closes any newly registered popout while screensaverActive is true. Checked live: with the screensaver running, omarchy-shell omarchy.weather open put the panel over the screensaver on the previous commit, and on this one it closes.
  • Clone switching: idleServiceId now reads pluginRegistry.registryRevision, like the other registry-derived bindings in shell.qml, since isEnabled() reads config through shellConfigProvider() and doesn't notify.
  • closeForPopoutSwitch owners: closeActivePopout() falls back to it when an owner has no close(), matching requestPopout().
  • shell.services dependency: now guarded the same way Background.qml guards it.

On runtime tests: bar-test.sh checks the source for this behavior, the same way the rest of the file does. Building all of Bar.qml with a driven idle service inside the quickshell harness would take a lot of new setup, so I verified it in the running UI instead. On two monitors, both the built-in weather panel and a third-party plugin panel closed in both orders (panel open before the screensaver starts, and panel opened after it's up). Both reopen normally afterward, and the shell log shows no QML errors.

🤖 Generated with Claude Code

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 7ecea86 and verified on a worker built from the Omarchy ISO, with this branch merged onto current quattro (821ae58, merges cleanly). The fix works; nothing found that needs changing.

Reproduction. On quattro, the weather panel (an omarchy-keyboard-panel layer surface) stayed mapped and drawn over the screensaver in both orders: open before omarchy-launch-screensaver force, and opened over IPC with omarchy-shell omarchy.weather open after the screensaver was up. With this PR both cases closed the panel within half a second, the clock panel behaved the same, and the panel reopened normally afterwards. Reverting the Bar.qml change brought the panel back over the screensaver. One side effect worth knowing: on quattro the screensaver launched with a panel open exited after about a second (#13265); with this PR it stayed up, since the panel closes as soon as the screensaver window appears.

Tests. test/shell.d/bar-test.sh passes on the worker (93 passed). ./test/cli stops at "vscode generated theme references current theme file", which fails identically on quattro without this PR. The PR has no CI checks.

Related. #13475 also closes open panels around the screensaver, but only once, from the launcher, so a panel opened after the screensaver is up stays on top; this PR covers both orders and both idle-started and forced launches. #13784 (screensaver fullscreen when a layer surface has focus) and #13776 (bar below the screensaver) fix neighbouring problems and don't overlap with this change.

Reviewed by Claude Opus 5.5 alone: the second opinion (Codex) did not run, because its daily review budget was spent. It waits on that second review and then on the maintainer.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 4, 2026
quattro now routes the bar's popout, click-target and layout changes through schedulePluginBarApiSync(), so the resolution keeps that and adds the screensaver check to onActivePopoutChanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 7, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch had stopped merging cleanly into quattro, so I merged current quattro (d9b970d) into it and pushed df6171b. The only conflict was in onActivePopoutChanged: quattro now calls schedulePluginBarApiSync() there, and the resolution keeps that and adds this PR's screensaver check. Nothing else in the PR changed.

Reproduction, re-run on the new head on a worker built from the Omarchy ISO, with the shell running from each tree. Polling the compositor's layers every 250 ms:

  • On quattro, the weather panel stays mapped while the screensaver is up, both when it was open before omarchy-launch-screensaver force and when it's opened over IPC once the screensaver is up.
  • On df6171b it's unmapped within 250 ms in both orders, and it reopens normally afterwards.
  • With the Bar.qml change reverted, the panel stays over the screensaver again.

Tests. test/shell.d/bar-test.sh passes on the worker (95 passed), and ./test/cli passes. The PR has no CI checks.

Second opinion. Codex at medium effort reviewed df6171b. It found the merge resolution correct and the change proportionate, and raised four points:

  • A cloned omarchy.bar, like a replacement bar, gets the plugin shell facade, which has no services or pluginRegistry. So screensaverActive stays false and the panel isn't closed there. I checked this in configureBar() and PluginShellApi.qml, and it holds. It's the gap the PR description already names, extended to clones of the built-in bar. It isn't a regression, and fixing it needs a new screensaver-state API for bar facades, which is a design decision for the maintainer.
  • The deferred closeActivePopout doesn't recheck screensaverActive. It could close a second panel only if the screensaver ended and that panel opened before the queued call ran.
  • closeActivePopout releases whichever popout is active after close() returns. That could release the wrong popout only if an owner's close() synchronously opened another panel, and no built-in panel does.
  • The new bar-test.sh assertions check source text rather than behaviour. That's how the rest of the file tests, and the worker reproduction above covers the behaviour.

I left the second and third points alone: neither has a realistic way to happen.

The fix works on current quattro, and the issue it fixes is linked. It waits on the maintainer, including on whether cloned and replacement bars should be covered here or in a follow-up.

@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Bar panel behavior when screensaver activates.

This appears safe to merge, with a non-blocking request to test the closing behavior.

Findings

  1. P2 Closing test misses broken calls ▶

Summary

The built-in bar now closes its registered panel when the enabled idle service reports a screensaver window.

  • Follows enabled idle-service clones and later service registration.
  • Also closes panels opened while the screensaver is already active.
  • Adds five source checks; the closing check should also test behavior.
  • ninepointlabs explicitly acknowledges that replacement third-party bars remain outside this fix because their shell facade has no services.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Enabled idle service or clone] -->|screensaverWindowCount changes| B[Bar.screensaverActive]
  B -->|becomes true| C[closeActivePopout]
  D[Panel registers activePopout] -->|screensaver already active| E[Deferred close]
  E --> C
  C --> F[Owner close or closeForPopoutSwitch]
  F --> G[Release popout]
Loading

Reviews (1) · Last reviewed commit: "Merge quattro into hide-bar-panels-durin..." · Reviewed by Greptile

Comment thread test/shell.d/bar-test.sh
Comment on lines +546 to +550
if ! perl -0ne 'exit(/function closeActivePopout\(\)\s*\{[^}]*?"close" in activePopout[^}]*?"closeForPopoutSwitch" in activePopout[^}]*?\}/s ? 0 : 1)' \
"$ROOT/shell/plugins/bar/Bar.qml"; then
fail "closing the popout goes through whichever owner registered it"
fi
pass "closing the popout goes through whichever owner registered it"

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.

P2 Closing test misses broken calls

The new check for closeActivePopout() only checks that the two method names appear. It still passes if neither method is called or if the owner is never released. Add a small behavior test with fake owners that checks close(), the closeForPopoutSwitch() fallback, and the final activePopout value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bar panels stay open and render above the fullscreen screensaver when the session goes idle

3 participants