Repository navigation
Honor D-Bus idle inhibits on the paths Chromium actually calls - #13359
HerrStolzier wants to merge 7 commits into
Conversation
Quattro dropped hypridle's org.freedesktop.ScreenSaver owner, so browser video cannot inhibit the screensaver. Export both ScreenSaver object paths plus PowerManagement.Inhibit, reap disconnected callers, and fold the published count into the idle service.
Automated AI review
Verified: at the D-Bus level the daemon does what the description says. It answers PowerManagement inhibits block the screensaver and the automatic lockEvery PowerManagement In an isolated run on a private bus, a PowerManagement Impact: music playing in any Chromium tab or web app, a long download, or an open WebRTC call keeps the screensaver and the automatic lock from firing. This goes beyond restoring hypridle, which owned only Suggested change: do not count PowerManagement cookies toward the idle count. Either stop owning The state watcher is armed once, on a directory that may not exist yet
This is based on Quickshell and Qt source plus a syscall-level replica of the watch setup: with Impact: when the idle service loads before the daemon's first publish, D-Bus inhibits are ignored until the shell restarts, which is the original #6475 behaviour, while Suggested change: create the directory before arming and then call The user unit needs the omarchy-settings install lineomarchy-settings does not yet install Impact: systemd checks every unit name before enabling any (checked with systemd 261 Suggested change: land this together with the omarchy-settings and omarchy-settings-dev install line. The open omacom/omarchy-pkgs#210 (written for #8452, same unit filename) already adds exactly that line to both recipes. Smaller notes
Review informationTest scope: source review of all changed files, the idle service and the install, migration and first-run paths, plus Quickshell v0.3.1, Qt, systemd, Chromium 152, VLC, Firefox and hypridle source. Isolated runs (the daemon cases on private D-Bus buses) covered the daemon, the probe, the PR tests with mutation checks, the migration with a stubbed AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
PowerManagement Inhibit is Chromium's audio/download/WebRTC lock, not video. Leave that name unowned so background tabs cannot pin the screensaver. Create the runtime state directory before FileView watches it, and enable the user unit outside the first-run batch so a missing packaged file cannot fail sleep-lock.
|
The three items from the community review are in 606bd45:
The dead-pid probe case now uses an exited child instead of pid 1. Happy to adjust further. |
Automated AI review
Outcome: At
|
NameOwnerChanged fires for every name a connection releases, not only its unique name. A browser giving up its MPRIS name while still playing lost every cookie it held, and the screensaver came back over the video. Reap only when the unique name itself goes away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
enable-user-units.sh now reads OMARCHY_PATH under set -u to find the checkout copy of the idle-inhibit unit, so the test failed wherever the caller had not exported it, and wrote its fallback symlink into the caller's real XDG_CONFIG_HOME where they had. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The daemon leaves org.freedesktop.PowerManagement unowned so background audio cannot hold the lock off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A refresh asked for while the probe was running was dropped, and the probe may already have read the older state. Releasing the last inhibitor in that window left idle suppressed until the next change, so the lock never came back after the video stopped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
The daemon publishes an empty state only from its SIGTERM handler. Killed or crashed with a holder recorded, it left a nonzero count behind, and if systemd could not restart it nothing ever replaced that file, so the screensaver and the automatic lock stayed off for the rest of the session. ExecStopPost runs however the service ends, and removing the file wakes the shell's watcher, whose probe then reads no inhibitors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed and tested at Reproduced on a worker built from the Omarchy ISO, with the screensaver timeout set to 8 s and a client holding a D-Bus
Pushed to your branch:
Tests on the worker: Second opinion: Codex Medium reviewed the whole change three times. Its earlier passes found the well-known-name reaping and the dropped-refresh problems fixed above. Its last pass, on Related: this fixes #6475. #6572 takes the same approach but exports only Waiting on the maintainer: the packaging line for the unit has to land, and #6572 and #8955 still need a decision. |
|
| def handle_uninhibit(self, params: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None: | ||
| (cookie,) = params.unpack() | ||
| self.state.remove(cookie) | ||
| self.after_change() | ||
| invocation.return_value(None) |
There was a problem hiding this comment.
Old cookies cancel new inhibitors After the daemon restarts, it assigns cookies from 1 again, but existing clients may still hold cookies from the previous instance.
UnInhibit removes a matching cookie without checking who called it, so a client releasing an old cookie can cancel another client's new video inhibitor. The screensaver or lock can then appear during playback.
| self.after_change() | ||
| invocation.return_value(GLib.Variant("(u)", (cookie,))) |
There was a problem hiding this comment.
| FileView { | ||
| id: inhibitorStateDirWatcher | ||
| path: root.inhibitorStateDir | ||
| watchChanges: true | ||
| printErrors: false | ||
| onFileChanged: inhibitorProbeDebounce.restart() |
There was a problem hiding this comment.
Lost watch leaves lock disabled The inhibitor count is refreshed only at startup or after a directory-watch event. This repository already documents that a
FileView directory watch can permanently stop reporting changes after rapid updates. If that happens while the count is positive, a later release or daemon-stop file removal is never read, leaving automatic locking disabled indefinitely. Add a recovery path that does not rely on another watch event.
| if [[ -f $unit_source ]]; then | ||
| mkdir -p "$(dirname "$unit_dest")" | ||
| ln -sfn "$unit_source" "$unit_dest" |
There was a problem hiding this comment.
Fallback shadows packaged unit The migration and first-run setup create a user-level unit symlink when the packaged unit is absent, but neither removes it when the package arrives. Because the user unit takes precedence, those installations continue to ignore later packaged changes to this service. Remove or replace the fallback once the packaged unit exists.
|
Packaging for the unit is now omacom/omarchy-pkgs#779 (MERGEABLE, current omacom/omarchy-pkgs#210 is still open and conflicting; 779 is the successor (ScreenSaver only, this PR as consumer). |
|
Thanks for sticking with this. It's a real gap since hypridle went away (#6475). Two things before it can land:
def remove(self, cookie: int, owner: str) -> None:
holder = self.cookies.get(int(cookie))
if holder is not None and holder["owner"] == owner:
del self.cookies[int(cookie)]
def handle_uninhibit(self, sender, params, invocation) -> None:
(cookie,) = params.unpack()
self.state.remove(cookie, sender)
self.after_change()
invocation.return_value(None)
# dispatch(): self.handle_uninhibit(sender, params, invocation)
# __init__(): self.next_cookie = random.randint(1, 0x7FFFFFFF)Should-fix, both from greptile's Oct 3 review:
The packaging side (omacom/omarchy-pkgs#779) also has to land, or |
|
Thanks for the groundwork on this. |
|
Classification now agrees on I tested a local, unpushed candidate ( On that candidate, a synthetic D-Bus holder kept the screensaver off, including across a shell restart with the same daemon PID. Releasing it allowed the screensaver to run again. Removing the shell’s inhibit gate brought the failure back while the daemon still reported one holder. Reverting the ownership check and the publication fix separately also made the regression test fail. This did not exercise a real browser or a call.
GPT-6 High in Codex performed this review. Opus 5.5 High returned a written source review, including test gaps I checked: the probe lacks a live-PID success case, the private-bus scenarios reuse their state file, and the first-run structure assertion is obsolete after the base switched to enabling units individually. Those remain open in the local candidate. Both panel commands ended with status 143 before recording their final reviewer metadata; the supplementary reviewer produced no report. A separate The push is withheld because the protocol requires green tests. The #16533 handoff remains pending. Waiting on the maintainer for the packaging dependency and the choice among the open implementations; the live PR still conflicts with |
* Own org.freedesktop.ScreenSaver in the idle service Since the Quickshell idle service replaced hypridle, nothing on the session bus owns org.freedesktop.ScreenSaver. Chromium, Chrome, Brave, Electron, Steam, and xdg-desktop-portal-gtk send video and display wake locks to /org/freedesktop/ScreenSaver, and Firefox, Zen, and VLC use /ScreenSaver. Those requests fail with ServiceUnknown, so the screensaver and lock fire over playing video (including fullscreen Netflix and YouTube). Run a small PyGObject helper (screensaver.py) as a child Process of IdleService: - owns org.freedesktop.ScreenSaver on both /org/freedesktop/ScreenSaver and /ScreenSaver; - leaves org.freedesktop.PowerManagement unowned so Chromium audio-only tabs, downloads, and WebRTC never pin the screensaver or lock off; - allocates random nonzero cookies (avoiding 0, which xdg-desktop-portal-gtk skips on UnInhibit), enforces per-caller ownership on UnInhibit, caps outstanding inhibitors at 256, and reaps a caller only when its unique bus name vanishes; - exits promptly when stdin closes, stdout breaks, or no session bus exists, and restarts after 5s on unexpected crashes. IdleService folds active app inhibitors into idleEnabled without writing the user stay-awake file, stops an active idle-launched screensaver when an inhibitor arrives, flips stayAwake directly in idle toggle, and lists appInhibitors in idle status. Builds on #16533 (@eesoymilk) and #13359 (@HerrStolzier). * Use OMARCHY_PATH directly and test broken-pipe and no-bus exits Rely directly on Quickshell.env("OMARCHY_PATH") for screensaver.py per AGENTS.md instead of deriving a fallback path. Also silence Python's exit stdout flush after BrokenPipeError and cover both broken-stdout and missing-session-bus exits in test/shell.d/idle-test.sh. * Use /usr/bin/python3, cancel launching screensaver, and flush broken-pipe error Invoke /usr/bin/python3 directly so a mise or PATH Python without system python-gobject cannot break the ScreenSaver helper. Stop an in-flight screensaver launch process when an app inhibit arrives, and flush the D-Bus connection before exiting on BrokenPipeError so the caller receives the error reply reliably.
|
Thanks @HerrStolzier merged via #20606 |
* Own org.freedesktop.ScreenSaver in the idle service Since the Quickshell idle service replaced hypridle, nothing on the session bus owns org.freedesktop.ScreenSaver. Chromium, Chrome, Brave, Electron, Steam, and xdg-desktop-portal-gtk send video and display wake locks to /org/freedesktop/ScreenSaver, and Firefox, Zen, and VLC use /ScreenSaver. Those requests fail with ServiceUnknown, so the screensaver and lock fire over playing video (including fullscreen Netflix and YouTube). Run a small PyGObject helper (screensaver.py) as a child Process of IdleService: - owns org.freedesktop.ScreenSaver on both /org/freedesktop/ScreenSaver and /ScreenSaver; - leaves org.freedesktop.PowerManagement unowned so Chromium audio-only tabs, downloads, and WebRTC never pin the screensaver or lock off; - allocates random nonzero cookies (avoiding 0, which xdg-desktop-portal-gtk skips on UnInhibit), enforces per-caller ownership on UnInhibit, caps outstanding inhibitors at 256, and reaps a caller only when its unique bus name vanishes; - exits promptly when stdin closes, stdout breaks, or no session bus exists, and restarts after 5s on unexpected crashes. IdleService folds active app inhibitors into idleEnabled without writing the user stay-awake file, stops an active idle-launched screensaver when an inhibitor arrives, flips stayAwake directly in idle toggle, and lists appInhibitors in idle status. Builds on omacom#16533 (@eesoymilk) and omacom#13359 (@HerrStolzier). * Use OMARCHY_PATH directly and test broken-pipe and no-bus exits Rely directly on Quickshell.env("OMARCHY_PATH") for screensaver.py per AGENTS.md instead of deriving a fallback path. Also silence Python's exit stdout flush after BrokenPipeError and cover both broken-stdout and missing-session-bus exits in test/shell.d/idle-test.sh. * Use /usr/bin/python3, cancel launching screensaver, and flush broken-pipe error Invoke /usr/bin/python3 directly so a mise or PATH Python without system python-gobject cannot break the ScreenSaver helper. Stop an in-flight screensaver launch process when an app inhibit arrives, and flush the D-Bus connection before exiting on BrokenPipeError so the caller receives the error reply reliably.



Fixes #6475.
Quattro replaced hypridle with the Quickshell idle service. hypridle owned
org.freedesktop.ScreenSaver; nothing does now, so D-BusInhibit()from browsers and players is dropped and the screensaver fires over playing video.What this does
omarchy-idle-inhibitownsorg.freedesktop.ScreenSaver(the same name hypridle owned) and exports the object paths clients actually call:/org/freedesktop/ScreenSaver— Chromium/Chromepower_save_blocker_linux.cc(video / display wake lock)/ScreenSaver— VLC, Firefox/Zenorg.freedesktop.PowerManagementis left unowned. Chromium uses that name for audio, downloads, and WebRTC; owning it would pin the screensaver and lock for background music. Chromium skips an unowned PowerManagement name, so video still inhibits via ScreenSaver.Inhibitors are ref-counted, reaped when the caller leaves the bus, and published as JSON under
$XDG_RUNTIME_DIR/omarchy/idle-inhibit/state(pid-signed so a crashed daemon cannot pin idle off). The idle service creates that directory before watching it (so a daemon that starts after the shell is still observed), folds the count intoidleEnabled, and derivesidle togglefrom the stay-awake flag.A user unit starts the daemon with the session. First-run enables it separately from the other units so a missing packaged unit cannot fail sleep-lock/fcitx. The migration enables it for existing Quattro installs and falls back to a checkout symlink when the packaged unit has not landed yet.
Why not #6572
#6572 only exports
/ScreenSaver. On Omarchy 4.0.4-1, Chromium 152 and Chrome 153 call/org/freedesktop/ScreenSaver; that path returnsUnknownMethodagainst #6572. #8452 covered both ScreenSaver paths plus PowerManagement and was closed as a duplicate of #6572.This is a fresh branch on current
quattro.Test
test/shell.d/idle-inhibit-test.sh— debug rendering, probe liveness (exited-child pid), private-bus Inhibit/UnInhibit/disconnect on both ScreenSaver paths, PowerManagement stays unowned, QML wiring, first-run enable isolationtest/shell.d/idle-test.sh— IdleModel parse/cancel/rearmPackaging note:
bin/*is already globbed into the omarchy package; the user unit needs aninstall -Dm644line in omarchy-settings (config-test.shasserts that mapping). omacom/omarchy-pkgs#210 already adds it. First-run and the migration keep sessions working until that lands.