Skip to content

Give cloned menus their application library - #11285

Closed
sfk8815-create wants to merge 1 commit into
omacom:quattrofrom
sfk8815-create:fix/manifest-has-kind
Closed

sfk8815-create wants to merge 1 commit into
omacom:quattrofrom
sfk8815-create:fix/manifest-has-kind

Conversation

@sfk8815-create

Copy link
Copy Markdown

Closes #11282.

manifestHasKind() required a real JS array: Array.isArray(manifest.kinds). Panel, overlay, and menu plugins are instantiated from panelEntries through an Instantiator model, and nested arrays come back from that model as QV4 sequence wrappers instead of JS arrays — Array.isArray() is false for them while String(kinds) and kinds.indexOf("menu") still work.

A cloned menu therefore failed the menu check in createScopedPluginShell(), was handed appLibrary: null, and Menu.qml's mergeAppRows() returned at if (!root.appLibrary) return, leaving the Apps submenu empty with nothing in the log to explain it. First-party menus never reach the check because pluginShellFor() early-returns the host shell for manifest.__isFirstParty, which is why this only shows up once the menu is cloned (or shipped by a third party).

The fix accepts any array-like kinds list.

Verification

  • Minimal reproduction in an isolated Quickshell: a manifest passed through an Instantiator model reports [object V4Sequence] for kinds, Array.isArray(...) === false, kinds.indexOf("menu") !== -1. With this change the kind check returns true for it; a manifest read straight from installedPlugins still returns true, and "service" / null still return false.
  • Live shell (Omarchy 4.0.3, cloned sfk.menu, omarchy.menu disabled): omarchy-shell shell call sfk.menu mergeAppRows left childCount("apps") at 0 before the change; loading the same Menu.qml in an isolated Quickshell with a working appLibrary injected gives 73 rows, so the menu code itself is fine once the library is handed over.
  • ./test/all on this machine: 3349 assertions pass. The two failures I see locally (bar-icon-geometry-test.sh, launch-about-test.sh) fail identically on the unmodified tree here, so they are environment-specific rather than caused by this change.

I checked the other Array.isArray(manifest.kinds) call sites in shell.qml (isBarOptionManifest, isBarWidgetPanelPlugin, ensureService, _syncServices, computePanelEntries, listPlugins); they all read manifests straight from installedPlugins or the live config, so this was the only one reached with a model-delivered manifest.

Before/after captures of the Apps submenu are attached to #11282. Happy to fold this into a different shape (for example a helper that also normalizes the manifest at the loader) if you prefer.

Panel, overlay, and menu plugins are instantiated from panelEntries through an
Instantiator model. Nested arrays come back from that model as QV4 sequence
wrappers rather than JS arrays, so the Array.isArray() check in
manifestHasKind() rejected every manifest that arrived that way. A cloned menu
failed the "menu" check, was handed no application library, and its Apps
submenu came up empty with nothing in the log to explain it. First-party menus
never reach the check because pluginShellFor() early-returns the host shell for
manifest.__isFirstParty.

Accept any array-like kinds list instead.
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 48ddb62 and run on a disposable Omarchy ISO worker with a real Hyprland session. The bug was real, and this change fixes it on the tree it was written against. Current quattro no longer has the bug, though, so this change makes no difference there.

How I checked. On the worker I ran USER=test omarchy plugin clone omarchy.menu, added a log line at the top of the clone's mergeAppRows() saying whether root.appLibrary was set, restarted the shell, then ran omarchy-shell shell call test.menu mergeAppRows "" and childCount apps. I linked the shell to each tree in turn and confirmed with pgrep that Quickshell was serving it:

Why it is gone. #13439 (merged 2026-09-27) changed the panel Instantiator to use a ListModel that holds only scalars. The delegate now reads manifest straight from shell.pluginRegistry.installedPlugins[pluginId] (shell/shell.qml, panel delegate). The manifest no longer passes through a model, so kinds reaches manifestHasKind() as the registry's own JS array, and Array.isArray() accepts it. The change itself is sound: PluginRegistry.qml rejects any manifest whose kinds is not a non-empty array, so accepting anything with indexOf cannot let a string kinds through. It just has nothing left to fix. #10785 took the same approach and was closed for the same reason after its author confirmed it live.

Related. #11079, which is still open, also rewrites manifestHasKind(). It normalizes kinds as part of a broader fix for manifests that get converted while crossing other property var boundaries, such as the active bar's. If that lands, it covers whatever this would still cover. The issue it fixes, #10661, still describes released 4.0.4. The fix reaches users with the first release that includes #13439.

Not run. I didn't run the shell suite, since the result does not depend on it. The second opinion did not run either: the configured reviewer (Codex Medium) answered a ping, but today's review budget was already spent. This review is mine alone.

Nothing was pushed. This is waiting on the maintainer, who may want to close it as fixed by #13439. Thanks for the precise diagnosis and the minimal reproduction in #11282. They made this quick to confirm.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @sfk8815-create. Closing because #13439 already fixes this on quattro.

Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent.

@omarchybot omarchybot closed this Oct 3, 2026
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.

Cloned menu plugins show an empty Apps submenu (manifestHasKind rejects model-delivered manifests)

2 participants