Add Windows desktop app menu#28420
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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_MENUmodel 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
runDesktopMenuActionhelper 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} | ||
| /> |
This was referenced May 20, 2026
MyNameIsGMLi
pushed a commit
to MyNameIsGMLi/opencode
that referenced
this pull request
May 22, 2026
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.
Summary
Testing