From b55f925281ba0fd950cecb54dc304ca943c67342 Mon Sep 17 00:00:00 2001 From: SirBlobby Date: Wed, 19 Aug 2026 19:51:59 -0400 Subject: [PATCH] Fix the forked bar failing to load --- omarchy/README.md | 23 ++++++++++++++++++++--- omarchy/plugins/blob.bar/Bar.qml | 10 +++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/omarchy/README.md b/omarchy/README.md index f678e3d..1112d34 100644 --- a/omarchy/README.md +++ b/omarchy/README.md @@ -74,9 +74,26 @@ of the center. Omarchy 4 puts a drag-to-reorder handler on every bar module and persists the drop into `bar.layout`; once `blob.clock` leaves the center list, `centerAnchor` matches nothing and the center renders as a plain group. The bar config has no setting for this, so the only lever is `canReorder` in `Bar.qml`. -The copy is two lines away from stock: a `anchored` property on `ModuleSlot`, -and `canReorder` gated on it, which locks only the module named by -`centerAnchor`. Every other widget still drags. +The lock itself is two lines: an `anchored` property on `ModuleSlot`, and +`canReorder` gated on it, so only the module named by `centerAnchor` is pinned. +Every other widget still drags. + +Three more lines are needed just to make the file loadable outside the packaged +slot. Stock `Bar.qml` declares `omarchyPath`, `barWidgetRegistry`, and +`barConfig` as `required`, which only works for the built-in bar because the +host instantiates it from an inline `Component` that sets them. A plugin bar is +loaded by URL and configured in the loader's `onLoaded`, so the required +properties are still unset at construction and the whole bar fails to build. +The copy declares them as ordinary properties defaulting to `""`/`null`, and +guards the one `barWidgetRegistry.widgets` read; `applyBarConfig` already falls +back to an empty layout, so nothing renders until the host injects the real +config a moment later. + +When this happens the bar does not fall back to the stock one, it simply does +not appear: the host's `Loader.Error` branch calls a nonexistent `errorString`, +throws, and never sets `failedBarId`. If the bar ever vanishes after editing +this plugin, that is the first thing to check - `journalctl --user` will name +the offending property. Do not run `omarchy plugin clone omarchy.bar` to refresh it. That command copies the whole directory, including `widgets/`, whose manifests re-declare diff --git a/omarchy/plugins/blob.bar/Bar.qml b/omarchy/plugins/blob.bar/Bar.qml index 4486e61..878a39f 100644 --- a/omarchy/plugins/blob.bar/Bar.qml +++ b/omarchy/plugins/blob.bar/Bar.qml @@ -12,14 +12,14 @@ Item { id: root // The omarchy-shell host injects omarchyPath from OMARCHY_PATH. - required property string omarchyPath + property string omarchyPath: "" // Injected by the host shell so bar slots can resolve enabled widgets. - required property var barWidgetRegistry + property var barWidgetRegistry: null // Injected by the host shell every time shell.json is reloaded. Holds the // `bar:` subtree: position, centerAnchor, layout. The host owns file IO; // the bar just renders whatever it's handed. The bar font follows the // OS-level fontconfig monospace binding — it is not stored in shell.json. - required property var barConfig + property var barConfig: null // Injected by the host shell. Used for shell-wide actions such as opening // settings and persisting inline widget state. property var shell: null @@ -1533,10 +1533,10 @@ Item { // plugin enabled/disabled, etc.). Reading the `widgets` property creates // the binding dependency — the wrapped function call alone wouldn't. readonly property var registryComponent: { - var w = root.barWidgetRegistry.widgets + var w = root.barWidgetRegistry ? root.barWidgetRegistry.widgets : null if (customType) return null var registryName = root.canonicalWidgetId(moduleName) - return w[registryName] ? w[registryName].component : null + return w && w[registryName] ? w[registryName].component : null } readonly property bool qmlCustom: customType === "qml" readonly property bool commandCustom: customType === "command"