Repository navigation
Close open bar panels while the screensaver is up - #11239
ninepointlabs wants to merge 3 commits into
Conversation
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
There was a problem hiding this comment.
🟡 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 readingshell.services, but_servicesis populated asynchronously by_syncServices(). The shell explicitly exposesservicesas the binding dependency (andBackground.qmluses theshell.services ? ...pattern); without that dependency this can remainnullif the bar evaluates before the idle service is registered, soscreensaverWindowCountis never observed and the panel stays open. Readshell.servicesin this guard, asBackground.qmldoes.
readonly property var idleService: shell && typeof shell.serviceFor === "function"
? shell.serviceFor(idleServiceId) : null
shell/plugins/bar/Bar.qml:572
requestPopout()supports an owner withcloseForPopoutSwitch()when it does not exposeclose(), but this screensaver path only invokesclose. Such a registered plugin owner is merely released fromactivePopout; its popup remains open and can keep its focus grab. Mirror the fallback used inrequestPopout()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 changinginstalledPlugins. After switching from the built-in idle service to a clone,idleServiceIdcan remain cached asomarchy.idle, leavingidleServicenull 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.qmlor drive an idle service'sscreensaverWindowCount. 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.
| 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
|
Addressed the review in 7ecea86:
On runtime tests: 🤖 Generated with Claude Code |
|
Reviewed at 7ecea86 and verified on a worker built from the Omarchy ISO, with this branch merged onto current Reproduction. On Tests. 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. |
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>
|
This branch had stopped merging cleanly into 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:
Tests. Second opinion. Codex at medium effort reviewed df6171b. It found the merge resolution correct and the change proportionate, and raised four points:
I left the second and third points alone: neither has a realistic way to happen. The fix works on current |
|
| 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" |
There was a problem hiding this comment.
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.
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.qmlwatches the enabled idle service'sscreensaverWindowCount, the same signalBackground.qmlalready uses. When a screensaver window appears, it closes the active popout.pluginRegistry.resolveEnabledId("omarchy.idle"), so a user-cloned idle service still counts.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.shpasses, 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.omarchy dev linkon this branch, two monitors), I triggeredomarchy-launch-screensaver forcewith a panel open:omarchy.monitor(Display) panel: closed when the screensaver appeared and stayed closed after it exited.ninepointlabs.fastmail-calendar): same result.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