Skip to content

Add Windows desktop app menu#28420

Merged
Hona merged 2 commits into
anomalyco:devfrom
Hona:win-menu-titlebar
May 20, 2026
Merged

Add Windows desktop app menu#28420
Hona merged 2 commits into
anomalyco:devfrom
Hona:win-menu-titlebar

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented May 20, 2026

Summary

  • add a shared desktop menu model used by macOS native menu and Windows titlebar UI
  • render the Windows menu dropdown from shared menu data in the desktop titlebar
  • route desktop-only menu actions through shared Electron action handling

Testing

  • bun typecheck (packages/app)
  • bun typecheck (packages/desktop)
  • bun run build (packages/desktop)
  • git push hook ran bun turbo typecheck

@Hona Hona requested a review from adamdotdevin as a code owner May 20, 2026 02:47
Copilot AI review requested due to automatic review settings May 20, 2026 02:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a shared, cross-platform desktop menu model and uses it to power both the macOS native application menu and a new Windows titlebar dropdown menu, while also centralizing Electron-side handling for “desktop-only” menu actions.

Changes:

  • Added a shared DESKTOP_MENU model in @opencode-ai/app (exported as @opencode-ai/app/desktop-menu) to drive desktop menus across platforms.
  • Implemented a Windows titlebar dropdown (WindowsAppMenu) that renders from the shared menu model and routes actions through the Platform API.
  • Centralized Electron main-process handling of menu actions via a new runDesktopMenuAction helper and IPC bridge.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/desktop/src/renderer/webview-zoom.ts Exposes zoom helpers (reset/in/out) for reuse by desktop menu actions.
packages/desktop/src/renderer/index.tsx Adds platform.runDesktopMenuAction and routes zoom actions locally vs. IPC.
packages/desktop/src/preload/types.ts Extends ElectronAPI with runDesktopMenuAction typed to shared action union.
packages/desktop/src/preload/index.ts Wires runDesktopMenuAction to ipcRenderer.invoke.
packages/desktop/src/main/menu.ts Rebuilds macOS native menu from shared model and routes actions through shared handler.
packages/desktop/src/main/ipc.ts Adds IPC handler for run-desktop-menu-action.
packages/desktop/src/main/index.ts Improves command routing to use the focused window (fallback to main).
packages/desktop/src/main/desktop-menu-actions.ts New centralized main-process action router (window/edit/view/app actions).
packages/app/src/index.css Adds styling for the Windows dropdown menu content/submenus.
packages/app/src/desktop-menu.ts New shared desktop menu definition + platform visibility helper.
packages/app/src/context/platform.tsx Extends Platform interface with runDesktopMenuAction.
packages/app/src/components/windows-app-menu.tsx New Windows titlebar dropdown menu UI using shared menu data.
packages/app/src/components/titlebar.tsx Mounts WindowsAppMenu on Windows desktop.
packages/app/package.json Exports ./desktop-menu subpath for cross-package consumption.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +31
function nativeItem(entry: DesktopMenuEntry, deps: Deps): MenuItemConstructorOptions {
if (entry.type === "separator") return { type: "separator" }
if (entry.role) return { role: nativeRole(entry.role) }

Comment on lines +43 to +49
const action = entry.action
item.click = () =>
runDesktopMenuAction(BrowserWindow.getFocusedWindow(), action, {
checkForUpdates: deps.checkForUpdates,
relaunch: deps.relaunch,
})
}
}
const runAction = (action: DesktopMenuAction) => {
if (action.startsWith("edit.") && lastFocused?.isConnected) lastFocused.focus({ preventScroll: true })
void props.platform.runDesktopMenuAction?.(action)
Comment on lines +45 to +53
<DropdownMenu.Trigger
as={IconButton}
icon="menu"
variant="ghost"
class="titlebar-icon rounded-md shrink-0"
aria-label="OpenCode menu"
onPointerDown={rememberFocus}
onKeyDown={rememberFocus}
/>
@Hona Hona added the beta label May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
@Hona Hona merged commit 82c5d45 into anomalyco:dev May 20, 2026
8 checks passed
MyNameIsGMLi pushed a commit to MyNameIsGMLi/opencode that referenced this pull request May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants