feat: add configurable stop shortcut#177
Conversation
7ef0161 to
1074989
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable keyboard shortcut for stopping active agent runs, defaulting to Ctrl+C. The implementation allows users to customize this shortcut through the Settings UI and properly wires it to the interrupt functionality.
Changes:
- Added
interruptShortcutsetting with "ctrl+c" as the default across TypeScript and Rust type systems - Created
useInterruptShortcuthook to handle keyboard events and trigger interruption when conditions are met - Extended Settings UI with a new "Stop active run" shortcut configuration field in the Composer section
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Added interruptShortcut field to AppSettings type |
| src/features/settings/hooks/useAppSettings.ts | Set default value for interruptShortcut to "ctrl+c" |
| src/features/settings/components/SettingsView.tsx | Added UI field for configuring the interrupt shortcut with proper state management |
| src/features/settings/components/SettingsView.test.tsx | Updated test fixture to include interruptShortcut: null |
| src/features/app/hooks/useInterruptShortcut.ts | New hook that listens for keyboard events and triggers interrupt callback when shortcut matches |
| src/App.tsx | Integrated useInterruptShortcut hook with canInterrupt state and interruptTurn callback |
| src-tauri/src/types.rs | Added Rust backend support for interrupt_shortcut field with default value and serialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
What about Linux and Windows where CTRL-C is copy? |
Good point. This was mainly intended for macOS, where copy is ⌘C and Ctrl+C is commonly used to interrupt running tasks (similar to terminal behavior). The shortcut is fully configurable in Settings, so it’s not meant to be a hard-coded cross-platform default. If/when Windows or Linux support becomes first-class, it would make sense to adjust the default per platform (or disable it by default there) while keeping the same mechanism. Also, the shortcut only triggers when there’s an active run that can actually be interrupted, so it shouldn’t interfere with normal text input / copy in practice. |
Summary
Testing