Skip to content

fix: hide native window menu bar on non-macOS and add frameless window resize borders - #198

Merged
Lampese merged 1 commit into
Lampese:mainfrom
bnku:fix/linux-gtk-menu-resize
Oct 1, 2026
Merged

Lampese merged 1 commit into
Lampese:mainfrom
bnku:fix/linux-gtk-menu-resize

Conversation

@bnku

@bnku bnku commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Description

This PR addresses two window UX issues on Linux (and other frameless desktop environments):

  1. Unwanted native menu bar: When app.set_menu was called unconditionally, GTK attached a native menu bar (Edit, Settings, Window, Help) to the window. Because Codex Switcher uses a custom dark titlebar with decorations: false, this native menu bar broke the UI design. Now app.set_menu is only invoked on macOS (where a global application menu bar is standard), while non-macOS desktop platforms manage tray/settings via the tray menu and in-app settings modal.
  2. Window resizing on frameless windows: Because decorations is set to false, GTK does not provide window borders. When the native menu bar was present, resizing only worked around the menu bar edges. This PR adds core:window:allow-start-resize-dragging permission and a lightweight <WindowResizeBorders /> overlay in the frontend that provides native resize cursor hover cues (n-resize, s-resize, w-resize, e-resize, corners) and delegates resize drag operations via startResizeDragging when not maximized.

Changes

  • src-tauri/src/app_menu.rs: Only attach window menu via app.set_menu on macOS; guard macOS-specific menu event handlers.
  • src-tauri/capabilities/default.json: Allow core:window:allow-start-resize-dragging.
  • src/components/WindowResizeBorders.tsx: Create resize border handles with correct cursors and resize drag triggers.
  • src/App.tsx: Mount WindowResizeBorders when running in frameless desktop mode and not maximized.

Testing

  • Tested on Linux (GTK / X11).
  • Frontend tests & build passed (pnpm build, npm run test:*).
  • Rust tests & formatting passed (cargo test, cargo fmt --check).

@Lampese
Lampese merged commit 59bce4f into Lampese:main Oct 1, 2026
6 checks passed
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