Skip to content

Overlay only the fields a menu extension declares - #11137

Open
vovarbv wants to merge 1 commit into
omacom:quattrofrom
vovarbv:fix/menu-partial-override
Open

Overlay only the fields a menu extension declares#11137
vovarbv wants to merge 1 commit into
omacom:quattrofrom
vovarbv:fix/menu-partial-override

Conversation

@vovarbv

@vovarbv vovarbv commented Sep 10, 2026

Copy link
Copy Markdown

docs/menu.md and the shipped sample extension both promise that reusing a shipped id replaces only the fields you declare, so an extension can retitle or re-icon a row without re-declaring its action. normalizeItem materializes every field with a default before mergeMenuSources overlays the entry, so a one-field override carried the other thirteen defaults with it.

The documented example is enough to reproduce it. With ~/.config/omarchy/extensions/omarchy-menu.jsonc containing {"items": {"about": {"icon": "X"}}}:

shipped   label="About" kind=action action="omarchy-launch-about" icon=""   visible=true
before    label="about" kind=menu   action=""                     icon="X"  visible=false
after     label="About" kind=action action="omarchy-launch-about" icon="X"  visible=true

The row lost its action, its label fell back to the bare id, it became a childless submenu, and isVisible then dropped it from the menu entirely.

normalizeItem now records which keys the author wrote and mergeMenuSources overlays only those, re-deriving kind from whatever action or target survived. A new id declared only in the extension is still taken whole, and merging with no extension leaves the shipped tree identical.

mergeAppRows and swapProviderRows replace whole rows rather than overlaying fields, so they were not affected.

The existing menu normalizes parsed items assertion pins the whole normalized item, so it gains the new key. The added assertions fail on quattro and pass with the change; ./test/shell and ./test/cli show no other difference from the branch point.

docs/menu.md and the shipped sample extension both promise that reusing a
shipped id replaces only the fields the author declares, so an extension can
retitle or re-icon a row without re-declaring its action. normalizeItem
materializes every field with a default before mergeMenuSources overlays the
entry, so a one-field override carried the other thirteen defaults with it.

The docs' own example, {"about": {"icon": "..."}}, wiped the row's action,
reset its label to the bare id, turned it into a childless submenu, and
isVisible then dropped it from the menu entirely.

Record which keys the author wrote and overlay only those, then re-derive
kind from whatever action or target survived. A new id declared only in the
extension is still taken whole.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant