Skip to content

Run the menu's guard batch once at startup, not once per menu file - #15048

Merged
dhh merged 2 commits into
quattrofrom
menu-open-startup-work
Oct 12, 2026
Merged

dhh merged 2 commits into
quattrofrom
menu-open-startup-work

Conversation

@dhh

@dhh dhh commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

defaultMenuFile and userMenuFile each call rebuildItemsFromSources() from their own onLoaded/onLoadFailed, and each rebuild called evaluateGuards(); the second run queued behind the first via guardsPending, so startup paid for the whole guard batch twice (~410ms of background work on the current batch).

Rebuilds now evaluate only once both files have answered at least once: loaded, or the user file missing, or the default failing (which also runs a user rebuild's held evaluation). Later edits to either file still re-evaluate, and openExistingMenu() still evaluates on every open, so a summon before both files land is unaffected.

An earlier revision also gated appLibrary.refreshIcons() on an unresolved icon. Codex showed that leaves a removed or relocated user icon cached until the next app-list change, and there is no cheap staleness signal for nested icon directories. That rescan runs async and off the open path, so it is left as it was.

Verification

  • menu-test.sh asserts the settled gating on all four FileView handlers and that openExistingMenu() still evaluates; passes. app-search-test.sh passes. qmllint reports no syntax errors.
  • Not restarted in the live shell from this branch (live verification is done centrally): after a shell restart, the first menu open should show correct guarded/checked rows, and editing ~/.config/omarchy/extensions/omarchy-menu.jsonc should still re-evaluate.

🤖 Generated with Claude Code

The default and user menu files load separately, and each load evaluated
every guard, so startup ran the whole batch twice, the second queued behind
the first. Wait until both have answered, loaded or missing; an open
before then evaluates on its own as always.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue remains.

Summary

The menu waits for both menu files to answer before running its startup guard batch.

  • The menu waits for both files before running startup guards.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[First menu file answers] --> B[Save items and mark source settled]
  B --> C[Hold startup guard evaluation]
  D[Second menu file answers] --> E[Mark source settled]
  E --> F[Evaluate guards]
  G[Menu opens] --> F
  H[Later file edit rebuilds items] --> F
Loading

Reviews (3) · Last reviewed commit: "Evaluate held menu guards when the defau..." · Reviewed by Greptile

Comment thread shell/plugins/menu/Menu.qml Resolved
Comment thread shell/services/AppLibrary.qml Resolved
Comment thread shell/services/AppLibrary.qml Resolved
Comment thread shell/services/AppLibrary.qml Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhh
dhh force-pushed the menu-open-startup-work branch from 0b2b642 to 60ad492 Compare October 11, 2026 14:47
@dhh dhh changed the title Stop doubling the startup guard run and rescanning icons on every menu open Run the menu's guard batch once at startup, not once per menu file Oct 11, 2026
@dhh
dhh merged commit f3cdce2 into quattro Oct 12, 2026
1 check passed
@dhh
dhh deleted the menu-open-startup-work branch October 12, 2026 13:31
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
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.

2 participants