Technical · 2026-04-26 · 12 min

A menu-bar app from scratch

MenuBarExtra is one of those SwiftUI additions where the API surface looks clean but the runtime is haunted. The shape of Promptory’s menu-bar entry went through three rewrites before settling.

Three rewrites

  1. Pure MenuBarExtra window — laggy on first paint because the window was created lazily and the contents had unbounded SwiftUI.
  2. NSStatusBar + manual NSPanel — fast, but every keyboard interaction had to be glued together by hand.
  3. MenuBarExtra with a small pre-warmed body — what shipped.

The body of this note will go through the pre-warming trick (a hidden view mounted at app launch), the global hotkey using Carbon (yes, still), and how to make a focusable, searchable panel that returns the user to whatever window they had focused before.

More notes