Overlay only the fields a menu extension declares - #11137
Open
vovarbv wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs/menu.mdand 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.normalizeItemmaterializes every field with a default beforemergeMenuSourcesoverlays 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.jsonccontaining{"items": {"about": {"icon": "X"}}}:The row lost its action, its label fell back to the bare id, it became a childless submenu, and
isVisiblethen dropped it from the menu entirely.normalizeItemnow records which keys the author wrote andmergeMenuSourcesoverlays only those, re-derivingkindfrom whateveractionortargetsurvived. A new id declared only in the extension is still taken whole, and merging with no extension leaves the shipped tree identical.mergeAppRowsandswapProviderRowsreplace whole rows rather than overlaying fields, so they were not affected.The existing
menu normalizes parsed itemsassertion pins the whole normalized item, so it gains the new key. The added assertions fail onquattroand pass with the change;./test/shelland./test/clishow no other difference from the branch point.