#13
Native menus driven by application commands
Problem
Rake apps have no menu API. The only menu is an internal set_menus call used by guarded quit. Apps that want a menu bar have to call GPUI directly. Those menu items then sit outside Rake's command system, so agents, the CLI and the menu bar can't trigger the same actions in the same way.
Proposal
Let a menu item refer to a registered ApplicationCommand by its stable ID:
- Choosing the item runs the command through the same path as
rake ctl commands run, so guards, cancellation and result reporting behave the same. - The item's label, shortcut, enabled state and checked state come from the command and the current app state.
- Standard OS items, such as About, Services, Hide and Quit, stay available. Quit goes through guarded quit.
- Context menus and the macOS dock menu use the same model.
GPUI already provides the building blocks: set_menus, set_dock_menu and key bindings. GPUI Kit's gpui-component also has a native_menu module. Reuse these, and keep Rake's part limited to connecting menus to commands.
Out of scope
- Custom-drawn menu bars on Windows or Linux beyond what GPUI already does.
- Web: browsers have no app menu bar. Commands stay reachable through in-app UI.
Done when
- An example app builds its menu from commands, and choosing an item runs the same handler as
rake ctl commands run. - A disabled command shows as a disabled menu item and refreshes when state changes.
- Tests cover running commands from menus, and Quit going through guarded quit.
- Docs explain how menus relate to commands.
Depends on
The move from GPUI CE to gpui-pre, so that this targets the menu API Kit uses.
Activity
0No activity yet.