Skip to content

feat(desktop-electron): Enable auto hide menu bar on main window#17243

Open
xpaksi wants to merge 1 commit intoanomalyco:devfrom
xpaksi:xpaksi/fix-linux-border
Open

feat(desktop-electron): Enable auto hide menu bar on main window#17243
xpaksi wants to merge 1 commit intoanomalyco:devfrom
xpaksi:xpaksi/fix-linux-border

Conversation

@xpaksi
Copy link

@xpaksi xpaksi commented Mar 12, 2026

Issue for this PR

Closes #17242

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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:
screenshot-2026-03-13_04-15-11

After:
screenshot-2026-03-13_04-14-25

After with alt clicked:
screenshot-2026-03-13_04-24-06

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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.

[FEATURE]: (desktop-electron) Enable auto hide menu bar on main window

1 participant