Repository navigation
fix(app): wire desktop menu accelerators to renderer commands - #41625
AmuletOfNight wants to merge 1 commit into
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #41592
Type of change
What does this PR do?
On Windows/Linux the desktop app renders the Window/View menus in-app instead of using a native Electron menu. The accelerators declared on those menu items (e.g. Ctrl+Shift+N) therefore never reached a handler, so the shortcuts did nothing. Only macOS worked, because it builds a real native menu from the same template.
The fix registers the in-app menu's per-platform accelerators as hidden renderer commands for the
windowsandlinuxplatforms. Each keypress dispatches throughplatform.runDesktopMenuAction()into the existing desktop IPC path - the same code path the in-app menu already uses when an item is clicked. Accelerator strings are normalized to the renderer keybind syntax (Ctrl+Shift+N->ctrl+shift+n;Cmd/Option->mod/alt;,->comma).How did you verify your code works?
desktop-menu.test.tscover binds discovery, keybind matching, and accelerator normalization (all passing).bun typecheckandbun test desktop-menu.test.tspass inpackages/app.Ctrl+Shift+Nopens a new window, and the same renderer path covers Windows.Screenshots / recordings
N/A - keyboard-shortcut handling change; verified via manual keypress testing rather than a recording.
Checklist