Skip to content

In-app File/View menu bar on Windows/Linux - #9

Open
adsharma wants to merge 2 commits into
mainfrom
fix/menubar-windows-linux
Open

adsharma wants to merge 2 commits into
mainfrom
fix/menubar-windows-linux

Conversation

@adsharma

@adsharma adsharma commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Problem

The File/View menus only worked on macOS. cx.set_menus() draws a native menu bar on macOS, but on Windows/Linux GPUI just stores the menus without displaying anything — so every menu command (Open Database, Toggle Schema View, view switching, Preferences, …) was unreachable there.

A second, related bug: keybindings used cmd-*, which off macOS means the Windows/Super key, so the shortcuts didn't work with Ctrl either.

Fix

  • src/ui.rs — new in-app File/View menu bar rendered on non-macOS (render_menu_bar, returns None on macOS where the native bar exists). It mirrors the native menus item-for-item; the app-menu Preferences…/Quit entries are folded into File since Windows/Linux have no app-menu convention. Dropdowns use deferred(anchored()) so they paint above the header/canvas, on_mouse_down_out dismisses on outside click, and each row invokes the same view method as its native counterpart.
  • src/main.rs — bindings switched from cmd-* to secondary-* (Cmd on macOS, Ctrl on Windows/Linux).
  • README.md — documented Ctrl shortcuts and the cross-platform menu bar.

Verification

  • cargo check + cargo clippy clean
  • All 43 tests pass (cargo test)
  • Menu code has no #[cfg]-gated APIs, so it type-checks on every target (a Linux-target link check wasn't possible here — no cross C++ toolchain for the vendored deps — would be good for CI to cover)

cx.set_menus only draws a native menu bar on macOS - on Windows/Linux
GPUI stores the menus without displaying anything, leaving every menu
command unreachable. Render an equivalent in-app File/View bar off
macOS (deferred+anchored dropdowns, click-outside to dismiss), fold the
app-menu Preferences/Quit entries into File, and switch bindings from
cmd-* (Super key off mac) to secondary-* (Cmd on mac, Ctrl elsewhere).
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.

1 participant