Repository navigation
Fix plugin bar loading and its silent failure - #7254
koenhendriks wants to merge 11 commits into
Conversation
Bar.qml declared omarchyPath, barWidgetRegistry, and barConfig as
required properties. QML refuses to instantiate a component whose
required properties are unset, and shell.qml's pluginBarLoader sets
`source` and injects afterwards in onLoaded via configureBar(), so the
component never got built and configureBar()'s `if (!target) return`
made it a no-op. Any bar plugin -- including the copy that
`omarchy plugin clone omarchy.bar` produces -- failed to load, leaving
the session with no bar at all.
Declare them plain with defaults, matching the plugin contract in
agents/skills/shell-dev.md ("accept the shell-injected properties") and
every other entry point: menu/Menu.qml and notifications/Service.qml
both do this, as do Bar.qml's own shell and manifest properties.
The built-in bar is unaffected: defaultBarComponent keeps passing all
three declaratively.
The Loader.Error handler read `errorString`, which is not defined on Loader. The ReferenceError aborted the handler before `shell.failedBarId = shell.activeBarId`, so the fallback to the built-in bar never ran and a bar plugin that failed to load produced a session with no bar and no explanation of why. Drop the errorString reference. The engine has already logged the component's own QML errors by the time this runs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (4)
shell/shell.qml:260
- The comment and behavior assume
Loadernever provides an error string. To make this more robust across engine/Qt versions and keep useful diagnostics, consider feature-detecting and logging details only when available (e.g., checktypeof errorString === \"function\"before calling), rather than permanently dropping the detail.
// Loader exposes no errorString; the engine has already logged the
// component's own QML errors by the time this runs. Reaching for one
// threw a ReferenceError here, which aborted the handler before the
// fallback below and left the session with no bar and no explanation.
console.warn("bar option " + shell.activeBarId + " failed to load, falling back to " + shell.defaultBarId)
shell/plugins/bar/Bar.qml:17
- Changing
barWidgetRegistryandbarConfigfromrequiredto optionalnullweakens the component contract and can turn a clear instantiation-time failure into later, harder-to-debug runtime errors when these values are used. Prefer keeping themrequired, or (if optional is intended) add an explicit early validation with a clear error message when they are missing.
property var barWidgetRegistry: null
shell/plugins/bar/Bar.qml:22
- Changing
barWidgetRegistryandbarConfigfromrequiredto optionalnullweakens the component contract and can turn a clear instantiation-time failure into later, harder-to-debug runtime errors when these values are used. Prefer keeping themrequired, or (if optional is intended) add an explicit early validation with a clear error message when they are missing.
property var barConfig: null
shell/plugins/bar/Bar.qml:15
- If
OMARCHY_PATHis unset,Quickshell.env(...)may return an empty/undefined-like value depending on the host API; assigning that into astringproperty can lead to surprising results. Consider normalizing the default to a definite string (for example, falling back to an empty string) so downstream path concatenation/usage behaves consistently.
property string omarchyPath: Quickshell.env("OMARCHY_PATH")
This reverts b05988c. Relaxing Bar.qml's required properties made a cloned bar load, but it weakens the component contract and only helps bars descended from a fixed Bar.qml: an existing clone, or any third-party bar that quite reasonably declares its injected properties required, still could not load. The loader is the thing that is wrong, so fix it there instead. Bar.qml keeps `required`.
A bar entry point declares omarchyPath, barWidgetRegistry, and barConfig as required, and QML refuses to instantiate a component whose required properties are unset. pluginBarLoader bound `source` and injected them afterwards in onLoaded, so the Loader failed before onLoaded ran and configureBar()'s `if (!target) return` made the injection a no-op. No bar plugin could load, `omarchy plugin clone omarchy.bar` included. setSource supplies them at creation, and Qt.binding keeps them live afterwards the way defaultBarComponent's declarative bindings do -- which also means a plugin bar now follows shell.json reloads instead of being stuck with the barConfig it was built with. Only the properties Bar.qml declares are passed; configureBar() still fills in the optional ones such as pluginRegistry on load. `active` no longer changes when switching straight from one bar plugin to another, so the source url drives the reload itself. The failure warning also names the file it tried to load, since the engine logs the component's errors without saying which bar option asked for them.
|
Thanks — the review's objection to relaxing Relaxing That turned out to fix a second, quieter bug: a plugin bar previously had Normalising the Feature-detect One note for anyone reproducing this: clear |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (3)
shell/shell.qml:277
- With the declarative
source:binding removed, the initial plugin load now depends on a change signal (onActiveChangedand/oronActiveBarSourceUrlChanged) to callloadPluginBar(). If the loader is constructed whenactiveis alreadytrueandactiveBarSourceUrlis already set (so neither changes after creation), nothing in this hunk guarantees an initialsetSource(...)call. Consider triggeringloadPluginBar()deterministically on component completion (e.g., viaComponent.onCompleted) so the initial bar plugin loads reliably.
active: !shell.pluginReloading && shell.activeBarId !== shell.defaultBarId && shell.activeBarSourceUrl !== ""
asynchronous: true
onLoaded: shell.configureBar(item, shell.activeBarManifest)
onActiveChanged: {
if (!active) shell.bar = null
loadPluginBar()
}
shell/shell.qml:295
- With the declarative
source:binding removed, the initial plugin load now depends on a change signal (onActiveChangedand/oronActiveBarSourceUrlChanged) to callloadPluginBar(). If the loader is constructed whenactiveis alreadytrueandactiveBarSourceUrlis already set (so neither changes after creation), nothing in this hunk guarantees an initialsetSource(...)call. Consider triggeringloadPluginBar()deterministically on component completion (e.g., viaComponent.onCompleted) so the initial bar plugin loads reliably.
Connections {
target: shell
function onActiveBarSourceUrlChanged() { pluginBarLoader.loadPluginBar() }
}
shell/shell.qml:273
onLoadedpassesshell.activeBarManifest, which can drift from the manifest that was intended for the specific load ifactiveBar*properties change while an asynchronous load is in-flight. Since the component is being created with an injectedmanifestproperty insetSource(...), prefer configuring with the loaded item’s manifest (or another value captured at load initiation) to avoid configuring a bar with the wrong manifest.
onLoaded: shell.configureBar(item, shell.activeBarManifest)
The relaxation of Bar.qml's three `required` properties was described as self-cancelling: "written as optional so it turns into a no-op once it lands". That is wrong. The accepted upstream fix (omacom/omarchy#7254) supplies the properties at creation in shell.qml and leaves `required` in Bar.qml, so the substitutions will keep firing after it ships -- silently and pointlessly rather than lapsing. They are a local workaround to delete by hand, and the check for when is now written down. Renamed optional() to workaround() and dropped its "already applied upstream, skipping" message, which under that fix can never be reached. Also record that a bar with no background is bar.transparent rather than a broken width patch: the flag is a double-left-click on empty centre-bar space away, and it presents exactly like the content-inset patch having failed. shell-bar.json deliberately does not pin it, so the gesture keeps working.
Removing the declarative `source` binding left the initial load depending on a change signal. A Loader constructed with `active` already true and `activeBarSourceUrl` already set would never call setSource, and the failure mode is a session with no bar at all. That ordering does not occur today -- the bar config arrives after construction, so `active` starts false and onActiveChanged drives the load -- but nothing enforces it, so do it on completion as well.
setSource injected omarchyPath, barWidgetRegistry, barConfig and manifest as Qt.bindings, but onLoaded hands the item straight to configureBar(), which reassigns all four from the live shell properties -- and onBarConfigChanged keeps barConfig current from then on. The bindings were overwritten almost as soon as they were made, so plain values say what actually happens. This also settles the review's concern about the manifest drifting during an asynchronous load: configureBar applies the current manifest at load time, so the value injected at creation only has to satisfy the required property.
|
Picked up the suppressed comments from the last review. Initial load not guaranteed — fixed in a229300. With Manifest drift during an async load — addressed in 2abba61, by removing the cause rather than reordering. Verified on Omarchy 4.0.0-1, Hyprland 0.56.2, two monitors, with a clone whose three
No new |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (5)
shell/shell.qml:271
manifestis injected into the component as a plain value at instantiation time, butonLoadedcallsconfigureBar()withshell.activeBarManifestat handler time. Because the Loader isasynchronous: true,shell.activeBarManifestcan change betweensetSource(...)andonLoaded, causing the instance to be created with one manifest but configured with another. Prefer passing the same manifest value through both paths (e.g., read fromitem.manifest, or capture the manifest used inloadPluginBar()and provide that exact value toconfigureBar).
setSource(shell.activeBarSourceUrl, {
omarchyPath: shell.omarchyPath,
barWidgetRegistry: shell.barWidgetRegistry,
barConfig: shell.barConfig,
shell: shell,
manifest: shell.activeBarManifest
})
shell/shell.qml:276
manifestis injected into the component as a plain value at instantiation time, butonLoadedcallsconfigureBar()withshell.activeBarManifestat handler time. Because the Loader isasynchronous: true,shell.activeBarManifestcan change betweensetSource(...)andonLoaded, causing the instance to be created with one manifest but configured with another. Prefer passing the same manifest value through both paths (e.g., read fromitem.manifest, or capture the manifest used inloadPluginBar()and provide that exact value toconfigureBar).
onLoaded: shell.configureBar(item, shell.activeBarManifest)
shell/shell.qml:274
- Reload is currently driven by
activetransitions andactiveBarSourceUrlchanges. Ifshell.activeBarId(or other inputs that affect injected properties, likeactiveBarManifest) changes whileactiveremains true and the URL stays the same, the loader will not reload and the injected plain (non-bound) values can become stale. Either (a) enforce an invariant that bar switches always changeactiveBarSourceUrl, or (b) add signal handlers for the other relevant change signals (e.g.,activeBarIdChanged/activeBarManifestChanged) to callloadPluginBar()(or update the already-loaded item if reload is undesirable).
active: !shell.pluginReloading && shell.activeBarId !== shell.defaultBarId && shell.activeBarSourceUrl !== ""
shell/shell.qml:288
- Reload is currently driven by
activetransitions andactiveBarSourceUrlchanges. Ifshell.activeBarId(or other inputs that affect injected properties, likeactiveBarManifest) changes whileactiveremains true and the URL stays the same, the loader will not reload and the injected plain (non-bound) values can become stale. Either (a) enforce an invariant that bar switches always changeactiveBarSourceUrl, or (b) add signal handlers for the other relevant change signals (e.g.,activeBarIdChanged/activeBarManifestChanged) to callloadPluginBar()(or update the already-loaded item if reload is undesirable).
onActiveChanged: {
if (!active) shell.bar = null
loadPluginBar()
}
shell/shell.qml:305
- Reload is currently driven by
activetransitions andactiveBarSourceUrlchanges. Ifshell.activeBarId(or other inputs that affect injected properties, likeactiveBarManifest) changes whileactiveremains true and the URL stays the same, the loader will not reload and the injected plain (non-bound) values can become stale. Either (a) enforce an invariant that bar switches always changeactiveBarSourceUrl, or (b) add signal handlers for the other relevant change signals (e.g.,activeBarIdChanged/activeBarManifestChanged) to callloadPluginBar()(or update the already-loaded item if reload is undesirable).
// Switching straight from one bar plugin to another keeps `active` true, so
// the url change has to drive the reload by itself.
Connections {
target: shell
function onActiveBarSourceUrlChanged() { pluginBarLoader.loadPluginBar() }
}
configureBar() assigns manifest imperatively when the bar loads, replacing whatever binding the component was created with -- for the built-in bar too. And activeBarManifest is recomputed from pluginRegistry.registryRevision, so a plugin rescan produces a new manifest while the entry-point url stays the same string. Nothing then reloads the loader or refreshes the value, leaving the bar holding a stale manifest. Push it on change, the way barConfig already is a few lines above. That also settles the creation-versus-load question for an asynchronous loader: the value injected at setSource only has to satisfy the required property, and the item's manifest ends up reflecting the current one either way rather than being frozen at whichever moment won. A bar switch needs no extra handling: activeBarSourceUrl is derived from activeBarManifest, which is derived from activeBarId, so changing the id always changes the url and the existing onActiveBarSourceUrlChanged drives the reload.
|
Fourth review picked up in 4085d7d. Both suppressed points came down to one gap, so one change covers them. Reload triggers — the branch the review suggested enforcing is already structural, so no extra signal handlers are needed for a bar switch. There is a real residue though, and the review is right about it: Fixed by pushing it on change, mirroring onActiveBarManifestChanged: if (bar && "manifest" in bar) bar.manifest = shell.activeBarManifestManifest consistency across an async load — this settles that too, rather than pinning the creation-time value. The value injected at Verified by running this branch directly ( |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
shell/shell.qml:278
loadPluginBar()only gates onactive, but it can also be called fromonActiveBarSourceUrlChanged(line 311) during the same change that will later flipactiveto false. In that ordering,activemay still be true whileshell.activeBarSourceUrlis already empty, leading tosetSource(\"\", { ... })and an avoidable load error/noise. Consider adding an explicit URL check before callingsetSource(url, props)(and unload viasetSource(\"\")when the URL is empty/invalid) so the method is safe regardless of signal/binding evaluation order.
function loadPluginBar() {
if (!active) {
setSource("")
return
}
setSource(shell.activeBarSourceUrl, {
omarchyPath: shell.omarchyPath,
barWidgetRegistry: shell.barWidgetRegistry,
barConfig: shell.barConfig,
shell: shell,
manifest: shell.activeBarManifest
})
}
shell/shell.qml:185
- This handler relies on an unqualified
baridentifier and an inlineifwithout braces, which makes it harder to read and easier to misinterpret (e.g., whether this is meant to referenceshell.barvs. anid: bar). Consider making the target explicit (e.g.,shell.bar) and using a braced block for clarity.
onActiveBarManifestChanged: if (bar && "manifest" in bar) bar.manifest = shell.activeBarManifest
loadPluginBar() only checked `active`, which does include
activeBarSourceUrl !== "" -- but a signal handler can run before that
binding is re-evaluated. On the change that empties the url,
onActiveBarSourceUrlChanged fires while `active` is still true, so
setSource("") was called with a property map attached: a load error for a
transition that is really just an unload.
Read the url once and check it explicitly, so the method is correct
whichever order the signal and the binding arrive in.
Verified by switching the active bar between a plugin bar and the built-in
one and back, which is the transition that empties the url: both directions
leave two bar surfaces up with no load errors.
|
Fifth review picked up: one fix, one push-back. Empty source url — fixed in b06256c.
onBarConfigChanged: if (bar && "barConfig" in bar) bar.barConfig = shell.barConfig
onActiveBarManifestChanged: if (bar && "manifest" in bar) bar.manifest = shell.activeBarManifestQualifying one and not the other, or bracing one and not the other, would make the pair harder to read than either style applied consistently. On the ambiguity specifically: Verified on Omarchy 4.0.0-1, two monitors, running this branch directly: |
| return | ||
| } | ||
|
|
||
| setSource(url, { |
Neither behaviour fixed here was reachable from the existing tests. manifest-entrypoints-test.sh instantiates the built-in bar directly, which exercises defaultBarComponent's declarative properties and never touches pluginBarLoader, so a regression that omitted the injected properties again, or one where Loader.Error stopped selecting the fallback, would pass. Two cases, both against the real shell rather than a stand-in, since the loader is part of shell.qml and a reimplementation in a fixture would only test itself: - a bar plugin declaring omarchyPath, barWidgetRegistry and barConfig as `required` -- QML cannot instantiate it unless the loader supplies all three at creation. It reports the values back through the result file, so a property arriving undefined fails rather than passing quietly. - a bar plugin that cannot load, asserting the log carries the fallback to omarchy.bar and no ReferenceError from the handler. Both were checked against the unfixed code. Without the loader fix the first case fails with "never loaded"; with only the errorString bug restored the first passes and the second fails with "did not fall back".
|
Test added in 6919f50 — You were right that nothing covered this path. Two cases, both against the real shell rather than a stand-in — the loader is part of
Both were checked against the unfixed code so they are not vacuous:
One thing I noticed while in there, and did not touch since it is outside this PR: the panel loader at |
| if ! grep -q "failed to load, falling back to omarchy.bar" "$log_broken"; then | ||
| sed -n '1,120p' "$log_broken" >&2 | ||
| fail "a bar plugin that cannot load did not fall back to the built-in bar" | ||
| fi |
The broken-bar case only grepped for the warning, which the Loader.Error handler prints before assigning failedBarId. So the test passed whether or not the fallback actually took: remove the assignment and the log still carries the warning. Ask the shell instead. Once it has given up on the broken bar, activeBarId is the built-in one, and listPlugins reports omarchy.bar as the active bar option and the broken plugin as inactive. The test now polls the IPC for that state. Checked against the case the old assertion missed: with the warning left in place and `shell.failedBarId = shell.activeBarId` removed, it now fails with "did not fall back to the built-in bar".
|
Fixed in 723623d. You are right that the assertion proved nothing: the handler prints that warning before assigning It now asks the shell for the state instead. Once the broken bar is given up on, Checked against exactly the hole you described: with the warning left in place and |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
shell/shell.qml:318
- The new signal-driven reload path is not exercised by this test: both test cases start with one selected plugin, so they would still pass if
onActiveBarSourceUrlChangedstopped reloading whileactiveremains true. Add a runtime case that installs two valid bar plugins, switches directly between them, and verifies the second entry point loads.
function onActiveBarSourceUrlChanged() { pluginBarLoader.loadPluginBar() }
The two existing cases each start with one selected plugin, so neither exercises the reload that the url change drives: remove it and both still pass. Add a case with two valid bar plugins that switches between them and waits for the second entry point to report in. The switch goes through enablePlugin, which sets bar.id with the in-process config mutator. Rewriting shell.json and reloading it does not test this path -- the reload empties the config on the way through, so activeBarSourceUrl passes through "", the loader deactivates and reactivates, and onActiveChanged does the reload. Mutating in place keeps both plugins installed and the url non-empty, so `active` never drops and only the url change is left to act. Checked by making onActiveBarSourceUrlChanged reload only when nothing is loaded yet, which is a handler that has stopped reloading while `active` stays true: the first two cases still pass, the new one fails.
|
Added in 6b39043. You were right that the path was uncovered: with The new case installs two valid bar plugins, starts on the first, then switches to the second and waits for that entry point to report its own id back. One thing the switch had to get right to be worth anything. Rewriting Checked against the failure you described — a handler that stops reloading while |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
shell/shell.qml:184
- This explanation is stale:
loadPluginBar()now suppliesmanifestas a plain initial value, not a binding, andconfigureBar()only replaces that plain value. Reword this to explain that a same-URL manifest rescan does not recreate the item, which is the actual reason the explicit update handler is needed.
// configureBar() assigns manifest imperatively at load, which replaces the
// binding the bar was created with -- and a manifest can be re-read (a plugin
// rescan) without its entry-point url changing, so nothing would reload the
// bar or refresh the value. Push it the same way barConfig is pushed above.
shell/shell.qml:308
- The broken-bar test verifies only fallback state and never asserts this new diagnostic or its failed URL. Removing or breaking the warning would restore the silent failure from the PR title while the suite still passes. Extend that case to inspect
log_brokenfor the expected bar ID, source URL, and fallback ID.
// Loader exposes no errorString; the engine has already logged the
// component's own QML errors by the time this runs. Reaching for one
// threw a ReferenceError here, which aborted the handler before the
// fallback below and left the session with no bar and no explanation.
console.warn("bar option " + shell.activeBarId + " (" + shell.activeBarSourceUrl + ") failed to load, falling back to " + shell.defaultBarId)
|
Reviewed at 6b39043 against current What What is still broken on What merging it onto In the test. Related. #7024 fixes a different leftover: the same The second opinion was Codex Medium. It independently found the creation-time facade bypass and the manifest handler, and it added the |
Fixes #7253.
omarchy plugin clone omarchy.barreports success and switchesbar.id, then the bar disappears from every monitor with nothing printed and no fallback. Two defects, the second hiding the first.1. A plugin bar's injected properties arrive too late
A bar entry point declares
omarchyPath,barWidgetRegistry, andbarConfigasrequired, and QML refuses to instantiate a component whose required properties are unset.shell.qmlreaches a bar two ways:defaultBarComponentpasses them declaratively — the built-in bar is fine.pluginBarLoaderboundsource:and injected them afterwards, inonLoaded: shell.configureBar(item, ...).The second can never work: the Loader fails before
onLoaded, andconfigureBar()opens withif (!target) return, making it a no-op. So no bar plugin could load — including a clone of the built-in bar, which is the documented way to customise one.setSourcesupplies them at creation instead, withQt.bindingso they stay live afterwards the waydefaultBarComponent's bindings do. That also fixes something that was quietly broken: a plugin bar previously gotbarConfigassigned once inonLoadedand never followed ashell.jsonreload. Only the propertiesBar.qmldeclares are passed;configureBar()still fills in optional ones such aspluginRegistryon load.Since
activedoes not change when switching straight from one bar plugin to another, the source url drives the reload itself.2. The
Loader.Errorhandler readserrorString, whichLoaderdoes not haveThe
ReferenceErroraborts the handler beforefailedBarIdis set, so the existing fallback toomarchy.barnever runs and the warning is never printed. That is why a broken bar option presents as a silently missing bar rather than an error. The warning now also names the url it tried to load, since the engine logs the component's own errors without saying which bar option asked for them.Verification
On Omarchy 4.0.0-1, Hyprland 0.56.2, two monitors. Both runs start from a cold
~/.cache/quickshell/qmlcache— a warm cache serves a previously compiledBar.qmland will happily mask this.omarchy plugin clone omarchy.bar+ restart →hyprctl layersshows noomarchy-barsurface on either monitor; journal shows the threeRequired property … was not initializedwarnings plusReferenceError: errorString is not defined.Bar.qmlis not modified, so the clone still declares all three asrequired../test/allshows the same 4 pre-existing failures with and without this change (they want a siblingomarchy-pkgscheckout, snapper config, and a pristine system; the fourth is an IPC-handler count that is off on this machine regardless of branch or active bar id).Note on the history
The first two commits relaxed
Bar.qml'srequiredproperties. Review pushed back on weakening the contract, which was fair, and the objection pointed at a better fix: relaxingBar.qmlonly helps bars descended from a fixedBar.qml, so an existing clone or a third-party bar that declares its injected properties required would still fail. The later commits revert that and fix the loader instead. Net diff isshell/shell.qmlonly.