omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Bar widgets under a replacement (cloned) bar cannot resolve their own service — panel dead-ends on "warming up"

Open Tiedeyez opened this issue 2 months ago • 4 comments

Environment

  • omarchy 4.0.3-1, Hyprland + quickshell
  • Reproduced with a bar plugin created via the plugin generator (manifest carries omarchy: { "clonedFrom": "omarchy.bar" })

What happened

After the 4.0.3 scoped-shell change, a third-party bar widget that pairs a service + bar-widget kind can no longer reach its own service when the bar is a replacement bar:

  • Stock Bar.qml injects bar for non-first-party widgets as a facade whose .shell is pluginShellForId(moduleName) — service-capable, trusted-bar only (Bar.qml:234-237).

  • A replacement bar receives a scoped shell with no pluginShellForId, and the generated clone's common widget pattern is target.bar = root (the bar root itself), so bar.shell.serviceFor("my.plugin") lands in createScopedPluginShell()._serviceLookup (shell.qml:608):

    return allowOwnService ? shell.pluginServiceFor(key, requestedId) : null
    

    where key is the bar's id. pluginOwnsTarget(barId, pluginId) is false for the hosted widget, so the lookup returns null.

  • Result: the widget's service binding stays null forever; the panel renders its "loading/warming up" placeholder and never resolves. The identical plugin works perfectly under the trusted default bar.

Steps to reproduce

  1. Any service + bar-widget plugin whose BarWidget reads bar.shell.serviceFor(moduleName) (e.g. a tree widget backed by Service.qml).
  2. omarchy plugins bar new → clone of omarchy.bar; keep the generated target.bar = root in ModuleSlot injectProps.
  3. Select the clone as the active bar and add the widget — the panel never receives its service.

Expected

Widget-coupled services resolve identically regardless of which bar (stock, or a user-selected omarchy.bar clone) hosts the widget. Plugin service objects are already gated by resolveEnabledId + the plugin's own manifest — the hosting bar's identity shouldn't shadow the widget's own id.

Proposed fix (locally validated)

Widen _serviceLookup only for the active bar when its manifest is an omarchy.bar clone the user deliberately selected; arbitrary custom bars keep the service-less facade:

_serviceLookup: function(requestedId) {
  if (allowOwnService) {
    var own = shell.pluginServiceFor(key, requestedId)
    if (own) return own
  }
  if (key === shell.activeBarId && shell.activeBarManifest
      && String(shell.activeBarManifest.id || "") === key) {
    var meta = Util.isPlainObject(shell.activeBarManifest.omarchy)
      ? shell.activeBarManifest.omarchy : null
    if (meta && String(meta.clonedFrom || "") === "omarchy.bar")
      return shell.serviceFor(shell.pluginRegistry.resolveEnabledId(requestedId))
  }
  return null
},

This fixes the case without touching any plugin. Alternatives for discussion: an explicit "widgetServices": true flag in the bar clone's manifest, or having the generated bar clone stamp pluginShellForBarEntry-style facades the way stock does (currently blocked — pluginShellForId is trusted-bar-only by design).

Happy to open a PR in whichever shape you prefer.

Tiedeyez avatar Sep 09 '26 21:09 Tiedeyez

I traced this on quattro (be7c7bf37) by reading the source; nothing was run, since the question is what the code allows rather than whether it fails. The symptom is real, and on quattro it is the intended behaviour of a security boundary rather than an accident.

Why the lookup is null. A third-party widget under a replacement bar gets its bar from pluginBarApiFor() (shell/plugins/bar/Bar.qml:2127), which gives a replacement bar pluginShellForBarEntry() instead of pluginShellForId() (Bar.qml:250-258). That entry facade (shell/shell.qml:705) carries lifecycle and settings callbacks but no _serviceLookup, so serviceFor() returns null (shell/services/PluginShellApi.qml:30). The target.bar = root wiring in the report is from an older clone; a clone of today's Bar.qml hands widgets the entry facade, so the reporter's change to createScopedPluginShell() would not reach this path.

Why it was built that way. 1702cf0be and 094c91306 ("Tighten replacement bar plugin boundaries", after a security report) made the entry facade service-less on purpose. The bar creates and keeps the facade it hands the widget, so any own-service lookup on it also gives the replacement bar the widget's live service object. docs/omarchy-shell.md:54 and manual/32-shell-plugins.md:42 document the limitation, and the manual says to switch back to the built-in omarchy.bar for such widgets.

On the proposed fix. omarchy.clonedFrom is a manifest field the plugin author writes (bin/omarchy-plugin-clone:73 sets it, but nothing verifies it). Trusting it would let any bar that claims omarchy.bar ancestry fetch every loaded third-party service through serviceFor(). Authentication services are stored separately and stay out of reach either way.

Related. #11713, #11796, #12648, #13289 and #14101 report the same limitation. PRs #13194, #13471 and #13633 each propose a different way to give hosted widgets their own service, and so each relaxes the documented boundary to some degree.

Codex Medium reviewed this independently. It agreed with the mechanism and the history, and it added two things: the proposed change leaves the entry facade untouched, and it could find no way to give a hosted widget its own live service without the hosting bar being able to read it too. Its independence is not guaranteed.

What happens next is the maintainer's call: keep the boundary, or allow a narrower grant like the ones those PRs propose. Nothing is waiting on you.

omarchybot avatar Oct 11 '26 11:10 omarchybot

This matches #14101 (and the broader third-party/cloned-bar serviceFor cluster: #13289, #12648, #13794). Fix PRs in flight: #13633 / #13471.

I'd close this as a duplicate of #14101 and keep discussion there.

jandrusk avatar Oct 13 '26 16:10 jandrusk

Same root cause on 4.5.0-3 with a different plugin, io.github.moizibnyousaf.omawhatsapp (kinds bar-widget + service), on a clone of omarchy.bar:

  • Stock omarchy.bar: clicking the bar icon opens the dropdown.
  • Clone (omarchy plugin clone omarchy.bar): the click does nothing and nothing is logged. omarchy-shell io.github.moizibnyousaf.omawhatsapp status keeps dropdownOpen: false, while the service itself is alive: status answers and openApp opens the window with all chats.
  • The widget does bar.shell.serviceFor(root.pluginId) (plugins/omawhatsapp/BarWidget.qml:13), which is null under the replacement bar, so Loader.active: !!root.oma never loads.

The own-service-only grant proposed in #13471 / #13633 is what this widget needs; it never resolves anything but its own service id. Adding a second real-world case in case it helps weigh the boundary.

jotenakis2 avatar Nov 06 '26 19:11 jotenakis2

The 4.5.0-3 omawhatsapp report is consistent with the same limitation on current quattro (419a5a7095d118a218d5f84548dbd83ce90067e6). I rechecked widget injection in Bar.qml, pluginShellForBarEntry() and PluginShellApi.serviceFor(): replacement-bar widgets still receive an entry facade with no service lookup. This was a source review; I did not reproduce the WhatsApp plugin on a worker.

PR #13633 has closed in favor of #13471; #13194 and #13471 remain open. This report predates #14101, which is now closed, so the suggestion to close this one as its duplicate does not apply. The documented workaround remains the built-in omarchy.bar.

Codex High reviewed the source, and Opus 5.5 High and muse-wonder via pi, thinking high, also reviewed it. They agreed that giving the shared entry facade a service lookup would also give the hosting bar access to that service; reviewer independence is not guaranteed. Whether to change that documented access policy remains the maintainer's decision. Nothing further is needed from the reporter for that decision.

omarchybot avatar Nov 18 '26 03:11 omarchybot