Open
Conversation
Collaborator
ldm0
commented
Mar 15, 2026
- Introduced a new shortcut management system allowing users to configure keyboard shortcuts.
- Added a dedicated Shortcut Settings overlay in Preferences for users to modify shortcuts.
- Implemented functionality to pause all shortcut handlers while the settings are open.
- Updated context menus, tray, and application menus to reflect current shortcut values.
- Enhanced shortcut capture and formatting utilities for better user experience.
- Added tests for shortcut storage, capture, and settings overlay functionality.
- Introduced a new shortcut management system allowing users to configure keyboard shortcuts. - Added a dedicated Shortcut Settings overlay in Preferences for users to modify shortcuts. - Implemented functionality to pause all shortcut handlers while the settings are open. - Updated context menus, tray, and application menus to reflect current shortcut values. - Enhanced shortcut capture and formatting utilities for better user experience. - Added tests for shortcut storage, capture, and settings overlay functionality.
There was a problem hiding this comment.
Pull request overview
Adds a configurable shortcut system to the Cardinal (macOS) frontend, including persistence, runtime hotkey handling, and a Preferences-driven UI for editing shortcuts.
Changes:
- Introduces a canonical shortcut data model + localStorage persistence, plus parsing/capture/format utilities.
- Adds a Shortcut Settings overlay reachable from Preferences, and wires shortcut updates through app hotkeys, context menus, app menu, tray menu, and the global quick-launch registration.
- Adds i18n strings and test coverage for shortcut capture, persistence, overlay UX, and updated hotkey behaviors.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents that shortcuts are now configurable and adds the new default binding for copying filenames. |
| doc/inner/shortcut-customization.md | Internal documentation describing the architecture and integration points for shortcut customization. |
| cardinal/src/utils/shortcutCapture.ts | New utility module for parsing/normalizing/capturing/matching shortcuts and converting to display/menu formats. |
| cardinal/src/utils/globalShortcuts.ts | Refactors global quick-launch registration to use stored shortcuts, support updates, and allow pausing while capturing. |
| cardinal/src/utils/tests/shortcutCapture.test.ts | Adds tests for capture/normalize/match/format and menu accelerator mapping. |
| cardinal/src/tray.ts | Updates tray menu to source accelerator from stored shortcuts and adds a refresh API. |
| cardinal/src/shortcuts.ts | New persisted shortcut model (defaults, storage key, hydration, and menu/tray accelerator derivation). |
| cardinal/src/menu.ts | Uses stored accelerators for Preferences/Hide menu items and supports temporarily disabling menu shortcuts. |
| cardinal/src/i18n/resources/zh-CN.json | Adds translations for Preferences shortcut row + shortcut settings overlay labels/errors. |
| cardinal/src/i18n/resources/en-US.json | Adds translations for Preferences shortcut row + shortcut settings overlay labels/errors. |
| cardinal/src/hooks/useShortcutSettingsController.ts | New controller hook coordinating open/close, pause behavior, and save pipeline (global/menu/tray refresh). |
| cardinal/src/hooks/useFilesTabState.ts | Makes search-history navigation configurable via ShortcutMap and allow disabling while capturing. |
| cardinal/src/hooks/useContextMenu.ts | Displays per-action shortcut accelerators from the current shortcut config. |
| cardinal/src/hooks/useAppHotkeys.ts | Replaces hardcoded app hotkeys with rules driven by ShortcutMap and an enabled toggle. |
| cardinal/src/hooks/tests/useFilesTabState.test.ts | Updates tests for new shortcuts/shortcutsEnabled options. |
| cardinal/src/hooks/tests/useContextMenu.test.tsx | Updates tests to pass shortcut config and validate accelerators. |
| cardinal/src/hooks/tests/useAppHotkeys.test.ts | Updates tests for shortcut-config-driven behavior and adds filename-copy coverage. |
| cardinal/src/components/ShortcutSettingsOverlay.tsx | New modal UI for recording/editing/resetting/saving shortcuts with capture error handling. |
| cardinal/src/components/PreferencesOverlay.tsx | Adds a “Shortcuts” row to open the shortcut settings overlay. |
| cardinal/src/components/tests/ShortcutSettingsOverlay.test.tsx | Tests shortcut recording + save pipeline and capture error rendering. |
| cardinal/src/components/tests/PreferencesOverlay.test.tsx | Tests the Preferences row triggers opening shortcut settings. |
| cardinal/src/App.tsx | Wires shortcut controller + shortcut props into hotkeys, context menu, files tab state, and overlay rendering. |
| cardinal/src/App.css | Styles for the new Preferences manage button and the shortcut settings modal. |
| cardinal/src/tests/shortcuts.test.ts | Tests storage defaults, persistence, invalid payload fallback, and accelerator derivation. |
| cardinal/src/tests/App.contextMenu.test.tsx | Updates mocks for new ShortcutSettingsOverlay usage and menu/tray refresh calls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+112
to
+116
| return definitions.map((definition) => ({ | ||
| id: definition.id, | ||
| text: definition.text, | ||
| accelerator: formatShortcutForDisplay(shortcuts[definition.shortcutId]), | ||
| action: definition.action, |
| event.preventDefault(); | ||
| event.stopPropagation(); | ||
|
|
||
| const result = captureShortcutFromKeydown(event, false); |
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.