feat(desktop-electron): Enable auto hide menu bar on main window#17243
Open
xpaksi wants to merge 1 commit intoanomalyco:devfrom
Open
feat(desktop-electron): Enable auto hide menu bar on main window#17243xpaksi wants to merge 1 commit intoanomalyco:devfrom
xpaksi wants to merge 1 commit intoanomalyco:devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #17242
Type of change
What does this PR do?
During creating browser window in desktop electron. Enable auto hide menu bar on window.
Based on the documentation, autoHideMenuBar is Auto hide the menu bar unless the Alt key is pressed. Default is false. available on linux and win32 platform. This will hide the gtk decoration specially on Linux.
This PR actually just add the autoHideMenuBar during main window creation.
const win = new BrowserWindow({ x: state.x, y: state.y, width: state.width, height: state.height, + autoHideMenuBar: true, show: true, title: "OpenCode", icon: iconPath(), ...(process.platform === "darwin" ? { titleBarStyle: "hidden" as const, trafficLightPosition: { x: 12, y: 14 }, } : {}), ...(process.platform === "win32" ? { frame: false, titleBarStyle: "hidden" as const, titleBarOverlay: overlay({ mode }), } : {}), webPreferences: { preload: join(root, "../preload/index.mjs"), sandbox: false, }, })How did you verify your code works?
I ran
bun run preview,bun run package:linux, and run the produced electron binary.Screenshots / recordings
Before:

After:

After with alt clicked:

Checklist