Skip to content

Re-implement D-Bus idle-inhibit support dropped in the Quattro rewrite - #6572

Open
shrijit37 wants to merge 9 commits into
omacom:quattrofrom
shrijit37:quattro
Open

shrijit37 wants to merge 9 commits into
omacom:quattrofrom
shrijit37:quattro

Conversation

@shrijit37

Copy link
Copy Markdown
Contributor

Summary

Re-implements the D-Bus idle-inhibit support that was lost when Quattro replaced hypridle with the Quickshell idle service.

hypridle natively owned org.freedesktop.ScreenSaver on the session bus, so apps playing video (Firefox, Chromium, Zen, VLC) could call Inhibit() to keep the screensaver from firing. That role was never reimplemented in the Quattro switch, so those Inhibit() calls are silently dropped and the screensaver fires during playback.

What changed

  • bin/omarchy-idle-inhibit — a small Python daemon that owns org.freedesktop.ScreenSaver on the session bus, tracks active Inhibit()/UnInhibit() calls, and writes the count + detail list to a state file. Self-heals on restart (writes count 0 on startup and on SIGTERM).
  • default/systemd/user/omarchy-idle-inhibit.service — user service that launches the daemon with Restart=always.
  • shell/plugins/services/idle/Service.qml — watches the state file and folds the D-Bus inhibitor count into idleEnabled, so any active inhibitor suppresses the screensaver and lock (pulls back an active idle cycle, re-arms when cleared).
  • bin/omarchy-debug-idle — renders the active D-Bus inhibitors (app/reason/cookie) for observability.
  • migrations/1785963476.sh — enables the service for existing Quattro users.
  • install/omarchy-base.packages — adds python-dbus for the daemon.
  • test/shell.d/idle-inhibit-test.sh — covers the debug rendering and daemon metadata.

Notes

Quickshell's FileView cannot observe a file that doesn't exist yet, and the daemon creates the state file around the same time the shell starts. To stay correct under that race, the idle service watches the parent directory (mirroring the existing barHiddenProbe/toggles pattern in Bar.qml) and re-probes the file via a Process. Verified live on the desktop: the shell picks up the file even when the daemon creates it after the shell has started.

The daemon answers raw GDBus calls (verified with gdbus call), which is what real browsers use.

Copilot AI balanced review requested due to automatic review settings August 6, 2026 10:20
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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

Reintroduces D-Bus idle inhibition for applications using org.freedesktop.ScreenSaver.

Changes:

  • Adds an inhibitor daemon and systemd service.
  • Integrates inhibitor state with Quickshell idle handling.
  • Adds migration, dependency, diagnostics, and tests.

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 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
bin/omarchy-idle-inhibit Implements the D-Bus daemon.
bin/omarchy-debug-idle Displays active D-Bus inhibitors.
default/systemd/user/omarchy-idle-inhibit.service Runs the daemon per session.
install/omarchy-base.packages Adds the Python D-Bus dependency.
migrations/1785963476.sh Enables the service for existing users.
shell/plugins/services/idle/Service.qml Connects inhibitor state to idle behavior.
test/shell.d/idle-inhibit-test.sh Tests diagnostics and metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread shell/plugins/services/idle/Service.qml Outdated
Comment on lines +187 to +210
function handleInhibitorStateChanged() {
var previous = root.dbusInhibitorCount

if (previous === 0 && root.dbusInhibitorCount > 0) {
// An app started inhibiting mid-cycle: pull back the screensaver/lock.
if (root.idledThisCycle) root.cancelIdleCycle("dbus-inhibit")
} else if (previous > 0 && root.dbusInhibitorCount === 0) {
// All inhibitors released: re-arm idle from the current monitor state.
logEvent("dbus-inhibit", "cleared")
Qt.callLater(root.handleIdleChanged)
}
}

function parseInhibitorState(text) {
var raw = text !== undefined ? text : ""
if (!raw || !raw.length) return

var parsed = JSON.parse(raw)
if (parsed && typeof parsed.count === "number") {
var count = parsed.count
if (count !== root.dbusInhibitorCount) {
logEvent("dbus-inhibit", "count=" + count)
root.dbusInhibitorCount = count
root.handleInhibitorStateChanged()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. parseInhibitorState now captures the old count into previous before overwriting root.dbusInhibitorCount, and handleInhibitorStateChanged(previous) takes it as an argument — so the 0 → >0 and >0 → 0 transition branches can actually distinguish added from removed inhibitors. I also added an idleEnabled guard at the top of launchScreensaver(), so a screensaver timer armed before an inhibitor arrived can no longer blank the screen.


[Service]
Type=simple
ExecStart=/usr/bin/omarchy-idle-inhibit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed on the test side: the unit is now in the package_defaults mapping in test/shell.d/config-test.sh (default/systemd/user/omarchy-idle-inhibit.service → /usr/lib/systemd/user/omarchy-idle-inhibit.service), alongside every other shipped user unit, so the settings PKGBUILD is verified to install it. The migration was also made self-sufficient for the case where the package unit has not landed yet (e.g. a local checkout update that ships migrations before the rebuilt package): it now installs a user copy at ~/.config/systemd/user/ when /usr/lib/systemd/user/omarchy-idle-inhibit.service is absent, then systemctl --user enable --now finds the unit either way.

Comment on lines +19 to +20
[Install]
WantedBy=graphical-session.target

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. omarchy-idle-inhibit.service is now added to the first-run enable list in install/user/first-run/enable-user-units.sh, so fresh installs start the daemon immediately rather than leaving it disabled. Existing installs get it through the new migration.

Comment thread shell/plugins/services/idle/Service.qml Outdated
Comment on lines +380 to +384
FileView {
path: root.inhibitorStateDir
watchChanges: true
printErrors: false
onFileChanged: inhibitorStateProbe.running = true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed with a debounce. The directory watcher now restarts a 50 ms Timer (inhibitorProbeDebounce) instead of setting inhibitorStateProbe.running = true directly. The daemon's atomic write emits two directory events (temp create + rename); the debounce collapses them into a single probe after they settle, so the second event can no longer be dropped because the process is already running. Verified live: inhibit and uninhibit both update the count immediately, including when the daemon creates the state file after the shell has started.

Copilot AI review requested due to automatic review settings August 6, 2026 11:27

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

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

Suppressed comments (1)

test/shell.d/idle-inhibit-test.sh:42

  • This check only parses the Python source and inspects metadata, so it does not exercise the new daemon’s primary D-Bus contract. Add a focused dbus-run-session test that starts the daemon with a temporary state file, calls Inhibit/UnInhibit through the supported object paths, verifies state transitions, and verifies cleanup when a caller disconnects; otherwise path/signature/lifetime regressions all pass this suite.
# The daemon binary is syntactically valid and declares its command metadata.
python3 -c "import ast; ast.parse(open('$ROOT/bin/omarchy-idle-inhibit').read())" \
  || fail "idle-inhibit daemon is valid python"

Comment thread shell/plugins/services/idle/Service.qml Outdated
Comment on lines +206 to +217
var parsed = JSON.parse(raw)
if (parsed && typeof parsed.count === "number") {
var count = parsed.count
if (count !== root.dbusInhibitorCount) {
// Capture the old count before overwriting it so the handler can tell
// whether inhibitors were added or removed.
var previous = root.dbusInhibitorCount
root.dbusInhibitorCount = count
logEvent("dbus-inhibit", "count=" + count)
root.handleInhibitorStateChanged(previous)
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. parseInhibitorState now defaults to count 0 and treats any object without a numeric count (or unparseable JSON) as zero, so the probe's {} fallback clears a stale nonzero count. Verified live: with an active inhibitor, removing the state file flips dbusInhibitors 1 → 0 and logs dbus-inhibit: cleared, re-arming idle instead of disabling the lock indefinitely.

Comment thread migrations/1785963476.sh Outdated
cp "$unit_source" "$unit_dest"
fi

systemctl --user enable --now omarchy-idle-inhibit.service >/dev/null 2>&1 || true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. The migration now checks omarchy-pkg-missing python-dbus and calls omarchy-pkg-add python-dbus before enabling the service, so existing users who update via pacman -Syu get the runtime dependency even though install/omarchy-base.packages is only reconciled for fresh installs.

Copilot AI review requested due to automatic review settings August 6, 2026 11:41

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

Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (1)

migrations/1785963476.sh:24

  • This copied unit permanently shadows /usr/lib/systemd/user/omarchy-idle-inhibit.service, because files under the user's systemd directory have higher precedence. A user who takes this local-checkout fallback will therefore never receive later packaged unit fixes. Make the fallback track the checkout rather than leaving a stale copy.
  cp "$unit_source" "$unit_dest"

Copilot AI review requested due to automatic review settings August 6, 2026 11:59
@shrijit37

Copy link
Copy Markdown
Contributor Author

All review feedback is addressed across the follow-up commits:

Round 2 (review comments 1–4):

  1. Captured the previous inhibitor count before overwriting it, and added an idleEnabled guard to launchScreensaver().
  2. Mapped the unit in config-test.sh's package defaults and made the migration install a user copy when the packaged unit hasn't landed.
  3. Added the unit to install/user/first-run/enable-user-units.sh.
  4. Debounced the directory watcher so the atomic-write rename events can't drop a probe.

Round 3 (new comments 5–6):
5. parseInhibitorState now treats a missing/invalid count as zero, so a daemon failure or deleted state file clears stale state instead of disabling the lock indefinitely.
6. The migration installs python-dbus before starting the service (pacman -Syu doesn't reconcile the base manifest).

Suppressed suggestions:

  • Added a dbus-run-session integration test that exercises the daemon's real D-Bus contract over a private bus: name ownership, Inhibit/UnInhibit state transitions, and release-on-disconnect.
  • The migration now ln -sfn's the fallback unit to the checkout instead of copying it, so it tracks future fixes rather than permanently shadowing the packaged unit.

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

Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (3)

migrations/1785963476.sh:27

  • This migration can run from a TTY/SSH session with no live user manager; in that case systemctl --user enable fails, || true hides it, and the runner permanently marks the migration complete without creating the graphical-session.target.wants link. The daemon then remains disabled at the next graphical login. Use the offline symlink fallback already established in migrations/1785167800.sh:8-25, and only start the unit when the graphical target is active.
fi

shell/plugins/services/idle/Service.qml:204

  • The new shell test exercises the daemon and debug rendering, but it never exercises this QML-side parser or the 0 → active → 0 cancel/re-arm transitions that actually connect D-Bus inhibition to idle behavior. Extract the state parsing/transition decision into IdleModel.js (as other idle logic is) and add focused cases to test/shell.d/idle-test.sh so malformed/missing state and both transitions cannot regress unnoticed.
  function parseInhibitorState(text) {
    var raw = text !== undefined ? text : ""
    if (!raw || !raw.length) return

test/shell.d/idle-inhibit-test.sh:88

  • dbus-run-session terminates its private bus after the foreground bash exits, but it does not terminate arbitrary background children. The daemon has no bus-disconnect exit handler, so every scenario leaves an idle daemon running indefinitely (and the holding clients survive until their sleep ends), leaking processes across the test suite. Add an EXIT trap inside the private session to terminate and reap all background jobs.
  dbus-run-session -- bash -c "
    python3 '$ROOT/bin/omarchy-idle-inhibit' --state-file '$daemon_state' >>'$daemon_log' 2>&1 &
    echo \$! >'$test_tmp/daemon.pid'

Copilot AI review requested due to automatic review settings August 6, 2026 12:04

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

Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (1)

test/shell.d/idle-inhibit-test.sh:88

  • Each scenario backgrounds the daemon (and two scenarios also background a client), but the nested shell never terminates or waits for those jobs. dbus-run-session stops its bus only; it does not reap these descendants, so this test leaves multiple daemon processes running after completion. Add an EXIT trap in the nested shell to kill and wait for all background jobs.
    python3 '$ROOT/bin/omarchy-idle-inhibit' --state-file '$daemon_state' >>'$daemon_log' 2>&1 &

Copilot AI review requested due to automatic review settings August 6, 2026 12:10
@shrijit37

Copy link
Copy Markdown
Contributor Author

Addressed the remaining suppressed suggestions in commit ccf73fd:

  1. Migration from TTY/SSH: now falls back to writing the graphical-session.target.wants symlink when systemctl --user enable fails (an update over SSH has no live user manager), matching the fcitx5 migration pattern. It only starts the unit inside an active graphical session, so the enablement can't be silently dropped with the migration marked complete.

  2. QML parser coverage: parseInhibitorState and the cancel/re-arm transition decision moved into IdleModel.js (inhibitorCountFromText, inhibitorTransition) so the shell test exercises malformed/missing state and both transitions — 11 new focused cases in idle-test.sh.

  3. Process leaks: each dbus-run-session scenario now kills its background children on exit (daemon + holding clients), so a test run can't leak processes into the suite.

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

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (2)

migrations/1785963476.sh:38

  • When systemctl --user enable fails because no user manager is available, the packaged-unit case leaves unit_dest nonexistent: it is only created when /usr/lib/systemd/user/omarchy-idle-inhibit.service is absent. This fallback therefore writes a broken wants symlink on the normal packaged update path, so the daemon will not start at the next graphical login. Select /usr/lib/systemd/user/omarchy-idle-inhibit.service when it exists and use unit_dest only for the checkout fallback.
  ln -sfn "$unit_dest" "$wants_dir/omarchy-idle-inhibit.service"

test/shell.d/idle-inhibit-test.sh:90

  • This trap sends signals but never waits for the background daemon/client to exit, despite the comment claiming they cannot leak. The daemon handles SIGTERM asynchronously and writes zero during shutdown, so it can survive dbus-run-session long enough to overwrite the shared daemon_state during a later scenario (or race the outer temp-directory cleanup), making this test flaky. Reap the jobs after killing them.
    trap 'kill \$(jobs -p) 2>/dev/null || true; wait 2>/dev/null || true' EXIT

Copilot AI review requested due to automatic review settings August 6, 2026 12:15

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

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (2)

migrations/1785963476.sh:39

  • When systemctl --user enable fails while the packaged unit exists, unit_dest was never created because lines 24–27 only create it when /usr/lib/systemd/user/... is absent. This fallback therefore installs a dangling wants symlink and the daemon will not start at the next graphical login. Select the packaged unit as the link target when it exists.
if ! systemctl --user enable omarchy-idle-inhibit.service >/dev/null 2>&1; then
  wants_dir="$user_config_home/systemd/user/graphical-session.target.wants"
  mkdir -p "$wants_dir"
  ln -sfn "$unit_dest" "$wants_dir/omarchy-idle-inhibit.service"
fi

shell/plugins/services/idle/Service.qml:27

  • idleEnabled is also the state used by the idle toggle IPC method at line 426. Making it false for a transient D-Bus inhibitor means toggle no longer toggles the user's stay-awake preference: with no stay-awake flag it tries to enable idle and does nothing, while with the flag set it clears it, unexpectedly enabling idle once the inhibitor disappears. Keep the effective inhibited state separate, or make the IPC toggle derive its next value from stayAwake rather than idleEnabled.
  readonly property bool idleEnabled: stayAwakeStateLoaded && !stayAwake && dbusInhibitorCount === 0

Copilot AI review requested due to automatic review settings August 6, 2026 12:21

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

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (1)

shell/plugins/services/idle/Service.qml:27

  • Including transient D-Bus inhibition in idleEnabled breaks the existing idle.toggle IPC behavior. While an app inhibits idle, idleEnabled is false even when stayAwake is false, so toggle() at line 426 calls setIdleEnabled(true) and becomes a no-op instead of enabling Stay Awake. Base the toggle decision on the persisted/manual stayAwake state (or split manual enablement from effective inhibition).
  readonly property bool idleEnabled: stayAwakeStateLoaded && !stayAwake && dbusInhibitorCount === 0

Copilot AI review requested due to automatic review settings August 6, 2026 12:30
@shrijit37

Copy link
Copy Markdown
Contributor Author

The toggle-derived-from-idleEnabled concern is fixed in commit 094c0cb: idle toggle now derives its next value from stayAwake (the user's persisted preference) rather than idleEnabled. Verified live on the desktop: with a D-Bus inhibitor active (enabled:false, stayAwake:false, dbusInhibitors:1), omarchy-shell idle toggle correctly flips stayAwake true→false→true, which the old code could not do (it no-opped on the enable side and would silently re-arm idle once the inhibitor cleared on the stay-awake side).

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

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.

shrijit37 and others added 9 commits August 7, 2026 21:19
hypridle natively owned org.freedesktop.ScreenSaver on the session bus, so
apps playing video (Firefox, Chromium, Zen, VLC) could call Inhibit() to keep
the screensaver from firing. When Quattro replaced hypridle with the Quickshell
idle service, that D-Bus role was never reimplemented, so Inhibit() calls are
silently dropped and the screensaver fires during playback.

Add a small daemon that re-owns the name and tracks active Inhibits in a state
file the idle service watches. The service suppresses idle while any inhibitor
is active, exactly as hypridle did. Fix omacom#6475.

Co-Authored-By: Claude <noreply@anthropic.com>
- Capture the previous inhibitor count before overwriting it so the
  transition handler can tell added from removed inhibitors; guard
  launchScreensaver against an inhibitor arriving while the timer runs.
- Ship the unit to /usr/lib/systemd/user in the package mapping and
  enable it at first run for fresh installs, not just via migration.
- Make the migration self-sufficient when the package unit has not
  landed yet by installing a user copy before enabling.
- Debounce the directory watcher: the daemon's atomic rename emits two
  events and a process already running would not be restarted, leaving
  a stale count.

Co-Authored-By: Claude <noreply@anthropic.com>
- Treat a missing or unreadable inhibitor state file as zero inhibitors so a
  daemon failure clears a stale nonzero count instead of disabling the lock
  indefinitely (the probe emits {} when the file is gone).
- Install python-dbus in the migration before enabling the daemon, since
  `omarchy update` runs `pacman -Syu` and does not reconcile the base package
  manifest for existing users.

Co-Authored-By: Claude <noreply@anthropic.com>
…ract

- Track each inhibitor's owning connection and release it on NameOwnerChanged
  when that connection leaves the bus, so a crashed browser or killed tab can't
  keep the screen awake forever.
- Exercise the daemon's actual D-Bus contract over a private bus with
  dbus-run-session: name ownership, Inhibit/UnInhibit state transitions, and
  release-on-disconnect.

Co-Authored-By: Claude <noreply@anthropic.com>
A copied unit at ~/.config/systemd/user permanently shadows the packaged
/usr/lib/systemd/user unit (user precedence), so users who took the fallback
would never receive later packaged fixes. Symlink to the checkout instead so
the enabled unit tracks its source. Also daemon-reload before enabling so the
linked unit is seen.

Co-Authored-By: Claude <noreply@anthropic.com>
- Migration: fall back to writing the graphical-session.target.wants symlink
  when systemctl enable fails (TTY/SSH update has no live user manager), and
  only start the unit inside a graphical session. Matches the fcitx5 migration
  pattern so the daemon isn't stranded at the next login.
- Move inhibitor state parsing and the cancel/re-arm transition decision into
  IdleModel.js so the shell test can exercise malformed/missing state and both
  transitions, not just the daemon's D-Bus side.
- Kill background children on exit inside the dbus-run-session scenarios so a
  test run can't leak idle daemons or holding clients.

Co-Authored-By: Claude <noreply@anthropic.com>
The EXIT trap killed each scenario's background children but did not wait on
them after the kill, so a descendant could still be terminating when the bus
went down. Kill and wait so a scenario cannot leak a daemon or holding client.

Co-Authored-By: Claude <noreply@anthropic.com>
…hildren

- In the migration's offline fallback, resolve the wants symlink target to
  /usr/lib/systemd/user/omarchy-idle-inhibit.service when the packaged unit
  exists, using the user-dir checkout link only when it does not. The previous
  code always symlinked the checkout fallback path, which does not exist on a
  normal packaged update and produced a broken wants link.
- In the test scenarios, SIGKILL (not SIGTERM) and wait on exit so the daemon's
  shutdown handler cannot asynchronously write zero over the shared state file
  and race a later scenario.

Co-Authored-By: Claude <noreply@anthropic.com>
…tate

idleEnabled is false while a D-Bus inhibitor is active, so the `idle toggle`
IPC method deriving its next value from idleEnabled dropped toggles issued
during playback: "enable idle" succeeded at nothing, and "stay awake" cleared
the flag so idle unexpectedly re-armed once the inhibitor was released. Flip
stayAwake (the user's actual preference) instead.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 7, 2026 15: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

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.

@FredrikMWold

Copy link
Copy Markdown
Contributor

Currently running into this issue using Stremio. Omarchy goes to sleep while a video is playing

@HerrStolzier

Copy link
Copy Markdown
Contributor

Tested this PR locally on Omarchy 4.0.4-1 (kernel 7.2.5-3-omarchy, AMD Ryzen 9 5950X, RX 6800, Hyprland 0.56.2, Chromium 152 / Chrome 153 on Wayland). Related to #6475.

What works

  • test/shell.d/idle-inhibit-test.sh: 8/8 (missing/empty state, debug rendering, daemon metadata, start-at-zero, persist, UnInhibit, disconnect reaping on a private bus).
  • IdleModel inhibitor cases in idle-test.sh: parse/zero/cancel/rearm/noop all pass.
  • Live on the real session bus, daemon run from the checkout (no omarchy dev link, no unit installed):
    • org.freedesktop.ScreenSaver is owned.
    • Inhibit("hold-client", …) on /ScreenSaver returns cookie 1 and the state file shows count: 1 for as long as the caller stays on the bus.
    • Caller disconnect → count 0. SIGTERM → name released.

Gap for Chromium/Chrome

This daemon only exports /ScreenSaver. Chromium 152 and Chrome 153 on this box call /org/freedesktop/ScreenSaver (power_save_blocker_linux.cc; confirmed in the binaries via strings). Live call:

$ gdbus call --session --dest org.freedesktop.ScreenSaver \
    --object-path /org/freedesktop/ScreenSaver \
    --method org.freedesktop.ScreenSaver.Inhibit chromium video
Error: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod:
Method "Inhibit" with signature "ss" on interface "org.freedesktop.ScreenSaver" doesn't exist

org.freedesktop.PowerManagement.Inhibit is also unowned (The name is not activatable). Chromium falls through to that as well.

So this would restore inhibit for clients that talk to /ScreenSaver (VLC, Firefox/Zen legacy path). It would not stop the screensaver over Chromium/Chrome video on this machine. #8452 covered both ScreenSaver object paths plus PowerManagement for that reason.

Rebase

Head is ~746 commits behind omacom/omarchy quattro. git merge-tree auto-merges Service.qml, omarchy-debug-idle, omarchy-base.packages, and config-test.sh. The only content conflict is install/user/first-run/enable-user-units.sh.

Happy to re-test a revision that also exports /org/freedesktop/ScreenSaver (and PowerManagement if you want Chromium's second backend).

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at b21b9332 against #13359, which fixes the same bug (#6475) the same way: a daemon that owns org.freedesktop.ScreenSaver and feeds an inhibitor count into the idle service. This one came first. The recommendation, though, is #13359, because it covers a case this one misses.

What this one misses. bin/omarchy-idle-inhibit exports the interface only at /ScreenSaver (OBJECT_PATH, line 39). Chromium and Chrome call /org/freedesktop/ScreenSaver instead. I checked the binaries on an Arch machine: Chromium 153.0.8010.52 and Chrome 154.0.8037.57 each contain the string /org/freedesktop/ScreenSaver and no standalone /ScreenSaver. This matches @HerrStolzier's live gdbus call above, which got UnknownMethod on the longer path. Chromium is Omarchy's default browser, so with this branch the screensaver would still fire over Chromium video. #13359 exports both paths and was reproduced on a worker: on quattro the screensaver fires over a held inhibit, and on that branch it stays off.

Checked here: the diff, read against #13359's. Both derive idle toggle from stayAwake, reap inhibitors only when the caller's unique name leaves the bus, and have a migration fallback for sessions with no user manager. Other than the second object path, this branch carries nothing #13359 lacks, so there is nothing to carry across. It also adds a python-dbus dependency that #13359 avoids by using python-gobject from the base packages. It currently conflicts with quattro in install/user/first-run/enable-user-units.sh.

Not run: I did not run this branch on a worker, because a fix that is not the recommended one would only spend a test machine.

Second opinion: none for this review. The configured reviewer, Codex Medium, answered a ping but had used up its daily review budget. An earlier Codex Medium review, run while #13359 was being reviewed, compared the two and also picked #13359 because this one misses Chromium's path. That review read this branch from the fork rather than the pinned commit, and its agreement is not independent of the reasoning here.

Waiting on the maintainer to choose between this and #13359.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Quattro] D-Bus idle inhibits are silently dropped since hypridle was replaced — screensaver fires during video playback (reproduced with Zen browser)

5 participants