Skip to content

Respect 1Password lock settings - #12784

Closed
alexvlis wants to merge 3 commits into
omacom:quattrofrom
alexvlis:fix/respect-1password-lock-settings
Closed

alexvlis wants to merge 3 commits into
omacom:quattrofrom
alexvlis:fix/respect-1password-lock-settings

Conversation

@alexvlis

@alexvlis alexvlis commented Sep 21, 2026 •

Copy link
Copy Markdown

Summary

Let 1Password honor its own Lock when computer locks preference instead of forcing 1password --lock. Omarchy publishes its compositor-confirmed lock state as ActiveChanged on org.freedesktop.ScreenSaver, the native signal 1Password listens for, through the same D-Bus service that handles idle inhibitors.

The branch is rebased onto current quattro as two commits:

  1. Own the freedesktop ScreenSaver name for idle inhibit and lock notifications. This is the idle-inhibit daemon from Honor D-Bus idle inhibits on the paths Chromium actually calls #13359, plus the lock bridge that feeds it.
  2. Respect 1Password's own lock settings. This removes the explicit 1password --lock call and the manual's claim that every Omarchy lock locks 1Password. It's only safe on top of commit 1.

Merge order

Commit 1 includes the shared-service implementation from #13359, which is still open, so the two PRs overlap. The simplest order is #13359 first, then this PR, which would then shrink to the lock bridge plus the 1Password removal. I'm also happy to move the GetActive/ActiveChanged part into #13359 so a single PR owns the public service.

Why a desktop integration is needed

Removing the CLI call on its own was unsafe. With 1Password's preference enabled, the vault stayed unlocked behind the lock screen, because a Wayland session lock alone doesn't notify 1Password.

In native testing, 1Password locked on ActiveChanged from an owned org.freedesktop.ScreenSaver service and logged Automatic(ScreenSaverActivated). An unowned signal and a temporary logind LockedHint change did not trigger a lock.

Architecture

  1. Compositor authority: SessionLockBridge.qml forwards WlSessionLock.secure, not lock requests or preview state, to a Python child as newline-delimited states. After a child restart it republishes the current state, and it backs off if the child keeps failing.
  2. Private publisher: shell/plugins/lock/session-lock-bridge.py owns only org.omarchy.SessionLock. It exposes GetActive and emits ActiveChanged there. Until the first compositor state arrives it reports NotReady instead of assuming the session is unlocked.
  3. One public owner: omarchy-idle-inhibit.service is the only owner of org.freedesktop.ScreenSaver. It implements Inhibit, UnInhibit and GetActive, and emits ActiveChanged on both /org/freedesktop/ScreenSaver and /ScreenSaver. Active inhibitors don't suppress notifications for a real compositor lock.
  4. Independent recovery: The shared service queries the private publisher whenever it appears, including when the shared service starts later or restarts. A late query result can't overwrite newer lock events. If the publisher disappears, the last state is kept rather than announcing an unlock while the compositor may still hold the lock.
  5. Explicit ownership failure: The public service neither replaces nor queues behind another owner of the name. Failing to acquire or keep the name, or failing to write inhibitor state, exits nonzero so systemd's Restart=on-failure retries.
  6. Application policy: 1Password receives the native desktop notification and applies its own preference. There are no 1Password-specific commands or credential operations. Gio/GLib come from the existing python-gobject dependency.

A migration enables the user unit on existing installs, and first-run enables it on new ones. The contract and recovery behavior are documented in docs/omarchy-shell.md.

Limitations

Retries can't deliver lock notifications while an unrelated process holds org.freedesktop.ScreenSaver, and there is no forced 1password --lock fallback.

Verification

Automated, on the rebased head

  • bash test/shell.d/session-lock-bridge-test.sh: all 23 checks pass. They cover:
    • contention for the public name, recovery after it's released, and leaving another owner's state file alone
    • nonzero exit when inhibitor state can't be written
    • inhibitors on both object paths alongside lock notifications
    • fragmented input, ordered transitions without duplicate signals, and invalid input
    • publisher replacement and loss, shared-service restart and reannouncement, and bus disconnection
    • the production SessionLockBridge.qml running in real offscreen Quickshell (ready handshake, state changes, forced child failure, restart, resync and cleanup) on an isolated bus with no desktop-service activation and no display access
  • bash test/shell.d/idle-inhibit-test.sh passes. It covers inhibitor lifetime, disconnect cleanup, both object paths, leaving org.freedesktop.PowerManagement unowned, and stop cleanup that clears a dead daemon's state without erasing a live owner's.
  • The idle, system-lock and config shell tests, ./test/cli and git diff --check all pass.

Native 1Password evidence

On Omarchy 4.0.4, Hyprland 0.56.2, Quickshell 0.3.1 and 1Password 8.12.40, publishing lock state on the owned ScreenSaver name locked 1Password with its preference enabled and left it unlocked with the preference disabled. That test used a temporary observer to forward the running shell's secure state; it wasn't a full dev-linked shell run.

@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

Verified: At 1933655, the explicit 1password --lock call is removed while the lock-screen request, keyboard-layout reset and screensaver shutdown sequence remain unchanged. No runtime regression was confirmed in the reviewed scope; one documentation correction remains.

Source comparison:

Before: Omarchy lock -> explicit 1Password CLI lock
After:  Omarchy lock -> no explicit 1Password CLI lock
                       native app response not verified

Documentation correction: The lock-screen manual still says the shortcut “locks 1Password on the way out” whenever it is running. Suggested change: remove that unconditional promise and explain that Omarchy no longer explicitly locks 1Password.

Native behavior remains unverified: The enabled-preference case depends on 1Password detecting this desktop's lock. The source requests Quickshell's Wayland session lock, and the linked support article documents the preference without establishing that integration. These checks therefore do not establish the PR's claim that 1Password still locks when the preference is enabled, nor demonstrate that it fails.


Review information

Test scope: Source inspection, per-file shell syntax checks and the focused shell test. The new assertion passed on the PR and rejected the original lock script. No native 1Password, compositor, suspend or credential-integration behavior was tested.

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Automated AI review: Astra Medium initial inspection and synthesis, independent Opus 5.5 High and GPT 6 Sol Xhigh technical reviews, followed by verification against source and targeted evidence.

@jandrusk

jandrusk commented Oct 8, 2026

Copy link
Copy Markdown

Before this lands I think we need proof that 1Password actually notices an Omarchy lock. As far as I can tell, nothing on quattro tells the session it's locked in a way 1Password could pick up. omarchy-system-lock only calls omarchy-shell lock lock (a Wayland session lock). There's no loginctl lock-session, no logind LockedHint, and no org.freedesktop.ScreenSaver service. If 1Password's "Lock when computer locks" relies on any of those, removing the explicit 1password --lock means the vault stays unlocked behind the lock screen for everyone who has the preference turned on. That's a quiet security regression.

Could you test on Omarchy with the preference enabled? Lock with Super + Ctrl + L, then (for example from an SSH session) run op whoami or check whether the 1Password window is still unlocked.

If it doesn't lock, the options I see are:

  • keep the explicit lock and add an opt-out (for example a state/toggle file that omarchy-system-lock checks before running 1password --lock), or
  • have the lock path set the logind locked hint so apps that respect it can react, and only drop the CLI call once that's confirmed to work.

@alexvlis

alexvlis commented Oct 9, 2026

Copy link
Copy Markdown
Author

Thanks @jandrusk for raising this. You were right: this was a real bug in the initial patch. I tested with Lock when computer locks enabled and reproduced exactly what you described—the vault stayed unlocked after locking Omarchy.

The fix is now in 89acd1c0. Rather than force-locking 1Password, the lock service publishes its compositor-confirmed secure/unlocked state through a small session-lock D-Bus bridge. The bridge owns org.freedesktop.ScreenSaver, answers GetActive, and emits ActiveChanged. That gives 1Password the native desktop notification it was missing, so its own preference controls the result.

I verified both cases with the bridge active: enabled locks the vault, disabled leaves it unlocked. The native probe also produced Automatic(ScreenSaverActivated) in 1Password's log. An unowned signal and a temporary LockedHint change did not trigger a lock on this machine.

For clarity about the test scope: the live test forwarded the running shell's secure state through a temporary observer; the new QML startup/restart wiring has automated coverage but has not yet been exercised in a full dev-linked shell. The PR description has been rewritten with the architecture, results, and test scope.

Thanks again for catching this before it landed—it exposed a security regression that the original source-level tests did not cover.

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Critical impact] The PR appears safe to merge; the previous cleanup issue is fixed and no new actionable issues were found.

Summary

The PR sends compositor-confirmed lock changes through org.freedesktop.ScreenSaver, letting 1Password follow its own lock preference.

  • Apps can pause Omarchy’s automatic idle actions with D-Bus inhibitors.
  • Desktop apps receive lock changes from Omarchy’s compositor.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["WlSessionLock.secure"] --> B["SessionLockBridge.qml"]
  B --> C["org.omarchy.SessionLock"]
  C --> D["omarchy-idle-inhibit"]
  D --> E["org.freedesktop.ScreenSaver"]
  E --> F["1Password applies its lock preference"]
Loading

Reviews (9) · Last reviewed commit: "Keep a live owner's inhibit state when a..." · Reviewed by Greptile

@jandrusk

Copy link
Copy Markdown

Thanks for testing it with the preference on, and for the bridge. Two problems with owning org.freedesktop.ScreenSaver this way:

  1. It collides with Honor D-Bus idle inhibits on the paths Chromium actually calls #13359. That PR also claims org.freedesktop.ScreenSaver (with Inhibit/UnInhibit, so Chromium, Firefox/Zen and VLC can hold off the screensaver). Both request the name with DO_NOT_QUEUE, so whichever starts first wins and the other silently gets nothing. If this bridge loses, 1Password never sees the lock, and with the explicit 1password --lock removed, the vault stays unlocked behind the lock screen. That's the regression we were trying to avoid.
  2. It answers only GetActive. Apps that find the name owned and call Inhibit get UnknownMethod back, which can be worse than the ServiceUnknown they get today, because some of them only fall back to the Wayland idle-inhibit protocol when the service is missing.

Suggestions: either work out one owner of the interface with #13359 (one service that handles Inhibit/UnInhibit and also publishes GetActive/ActiveChanged), or keep 1password --lock as a fallback whenever the bridge doesn't hold the name. Something like:

if ! busctl --user status org.freedesktop.ScreenSaver >/dev/null 2>&1; then
  timeout --kill-after=1s 3s 1password --lock >/dev/null 2>&1 || true
fi

(Better still if the check confirms the owner is this bridge and not some other process.)

@alexvlis

alexvlis commented Oct 18, 2026 •

Copy link
Copy Markdown
Author

Thanks @jandrusk — I went with your shared-owner option. The fix is pushed in c587bd167, with #13359's idle-inhibit implementation included as the base.

  • omarchy-idle-inhibit.service is now the only public org.freedesktop.ScreenSaver owner. It serves Inhibit, UnInhibit, and GetActive, and emits ActiveChanged on both supported object paths.
  • The lock helper owns only the private org.omarchy.SessionLock interface. The shared service receives compositor-confirmed state from it, so the two Omarchy components no longer compete for the public name.
  • Either component can restart independently: the service queries the current state when the publisher appears, ignores stale query results, and retains the last secure state if the publisher disappears rather than announcing a false unlock.
  • Public-name acquisition/loss now exits nonzero, so systemd's existing Restart=on-failure policy retries. A conflicting service is not replaced, and retrying cannot provide notifications while that other service still holds the name. There is no forced 1Password CLI fallback.

All 20 lock-bridge checks pass, including real name contention/recovery, inhibitor calls on both paths alongside lock notifications, shared-service restart/reannouncement, and the production QML component's offscreen lifecycle. The inhibitor suite, focused lock/idle/sleep checks, and CLI suite also pass.

The next step is coordinating the shared implementation and merge order with #13359, which is still open.

Comment thread bin/omarchy-idle-inhibit Resolved
Comment thread test/shell.d/idle-inhibit-test.sh Resolved
Comment thread bin/omarchy-debug-idle Resolved
…cations

Browsers and players ask org.freedesktop.ScreenSaver to inhibit idle, and
nothing has owned that name since hypridle was replaced (omacom#6475). A user
daemon now serves Inhibit/UnInhibit for the idle service, and relays the
lock plugin's compositor-confirmed lock state as ActiveChanged so desktop
apps can react to the session locking.
1Password now hears the session lock over org.freedesktop.ScreenSaver and
applies the user's preference, so stop forcing `1password --lock`.
@alexvlis
alexvlis force-pushed the fix/respect-1password-lock-settings branch from 64ded25 to dea00ed Compare November 12, 2026 00:02
@alexvlis

Copy link
Copy Markdown
Author

I rebased onto current quattro and squashed the branch into two commits:

  1. fa8c6d092 Own the freedesktop ScreenSaver name for idle inhibit and lock notifications
  2. dea00ed6b Respect 1Password's own lock settings

Nothing changed in behavior since c587bd167. The only changes are a rebase conflict in config-test.sh and a newer timestamp on the migration so it sorts after upstream's latest. The session-lock-bridge suite (23 checks, including the offscreen Quickshell run), the idle-inhibit, idle, system-lock and config tests, and ./test/cli all pass on the new head.

The open question is merge order with #13359, since commit 1 contains its idle-inhibit daemon. @HerrStolzier, I'd suggest #13359 lands first and this PR then shrinks to the lock bridge plus the 1Password removal. If you'd rather keep the public org.freedesktop.ScreenSaver service in one PR, I'm happy to move the GetActive/ActiveChanged part into #13359, whichever is easier for you and the maintainers.

The unit's stop cleanup deleted the shared state file unconditionally, so
a start that lost org.freedesktop.ScreenSaver to another daemon erased
that daemon's active inhibitors on every retry. Only remove the file when
its serving pid is gone.
@greptile-apps

greptile-apps Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@alexvlis

Copy link
Copy Markdown
Author

Closing in favor of #15183, which fixes the same problem (#15180) with a much smaller change. It keeps 1password --lock and skips it only when 1Password's own "Lock when computer locks" setting is off, so anything unexpected still locks the vault. As @jandrusk noted, that's the safer default. Unlike this PR, it doesn't depend on #13359.

The remaining value here was the lock-state forwarding (GetActive/ActiveChanged on org.freedesktop.ScreenSaver), and that belongs with the idle-inhibit daemon in #13359. @HerrStolzier, if you want it as a follow-up, the bridge is in fa8c6d092. #13359 also has the stop-cleanup issue fixed in 6f05b32fa: the unit's ExecStopPost deletes the state file even when another daemon owns the name. That fix only clears the file when its recorded pid is dead.

Thanks @jandrusk for the careful reviews.

@alexvlis alexvlis closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants