Repository navigation
feat(macos): the main menu in the menu bar (#784) - #805
volkovskey wants to merge 2 commits into
Conversation
On macOS the menu bar showed only winit's default app menu. The main menu now goes there through craft-menu (storytold/craft-libs#66), the shared menu bar of the Craft apps: the same items, labels, translations, shortcuts and enabled and checked state as the in-window menu, built from the catalog, with Open recent and the installed plugins' commands. craft-menu lays it out the Mac way (About and Settings in the FigCraft menu, Services, Hide, Quit through the window's close request, so unsaved changes are asked about; a Window menu), wakes the app on every menu event, and hands key equivalents back to egui, so FigCraft's own key handling still runs them. ui-egui builds the tree (`native_menu`, platform-free); the app installs it on macOS (`mac_menu`) and syncs it each frame. craft-menu is pinned to the craft-libs#66 head until that lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YQxjkNSUJhTkTfY74aNeki
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
|
Thank you, @volkovskey, this is well built:
It's held for a maintainer decision on the dependency:
|
…menu (storytold#784) Review fixes for the native menu bar: - Several windows: the menu bar is built for and runs its items in the window in front (`windows::as_window` on `windows.focused`), and its key equivalents go only into that window's input. A key equivalent that arrives while the main window draws is queued for the window in front, and a paste the menu bar asks of the main window goes on to it. - Translations: the labels the Mac layout writes (About, Hide and Quit FigCraft, Hide Others, Show All, Services, Settings…, Window, Bring All to Front, Close Window) are catalog keys, translated in every full catalog. A test checks the layout asks for no label outside them. - Duplication: the bar's menus are `menus::TOP_MENUS`, and the plugin rows come from `plugins_ui::menu_entries`, which the in-window Plugins menu now draws from too, so the bar gains the Widgets submenu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YQxjkNSUJhTkTfY74aNeki
|
Thanks for the review, @bflatastic. The fixes are in 2c6f24e:
Understood on the dependency. The pin stays until craft-libs#66 is reviewed and merged (including the |
|
Thanks @volkovskey! The pinned craft-libs rev 2bff0abb isn't on craft-libs' main (and isn't the current head of craft-libs#66). FigCraft can only depend on a craft-libs commit that's on its main, so this waits for #66 to merge; then please re-pin. |
|
A status update: this stays open, and here's what would let it land.
|
Closes #784.
On macOS the menu bar shows only winit's default app menu. This puts FigCraft's main menu there, through
craft-menu, the shared menu bar crate proposed in storytold/craft-libs#66 (see storytold/craft-libs#65).Draft:
craft-menuis pinned to the craft-libs#66 head (2bff0ab) until that lands. Once it does, the pin moves to the merged rev and this is ready for review.What it does
catalog::MENU. One source, so the two menus can't drift apart.craft-menu:Where it lives
ui-egui/src/native_menu.rs(platform-free): builds thecraft_menu::MenuBarfrom the catalog and routes a chosen id (file.recent:<path>,plugin:<id>:<command>, or a catalog id) the way the in-window menu does.apps/figcraft/src/mac_menu.rs(macOS only): installs the bar and syncs it each frame. The bar is rebuilt only after input.craft-menu,craft-quit,muda,crossbeam-channel,keyboard-types.craft-menuis a macOS-only dependency of the app; ui-egui uses only its platform-free tree types.Tests
native_menu_tests.rs(5 tests):Shortcuts are asserted for the Mac keymap on every platform, so the tests pass on Linux CI too.
file_access::tests::{links_that_lead_out_of_a_root_are_outside, outside_paths_are_refused_alike_whatever_exists_there}fail locally on macOS, and they fail the same way on a cleanmain, so this change doesn't cause them.🤖 Generated with Claude Code
https://claude.ai/code/session_01YQxjkNSUJhTkTfY74aNeki