Skip to content

feat: add configurable stop shortcut#177

Closed
shaw-baobao wants to merge 5 commits intoDimillian:mainfrom
shaw-baobao:feat/ctrl-c-interrupt
Closed

feat: add configurable stop shortcut#177
shaw-baobao wants to merge 5 commits intoDimillian:mainfrom
shaw-baobao:feat/ctrl-c-interrupt

Conversation

@shaw-baobao
Copy link
Contributor

@shaw-baobao shaw-baobao commented Jan 21, 2026

Summary

  • add a configurable stop shortcut in Settings (defaults to Ctrl+C)
  • wire the shortcut to interrupt the active run

Testing

  • npm run lint
  • npm run test
  • npm run typecheck

@shaw-baobao shaw-baobao changed the title feat: add Ctrl+C interrupt shortcut feat: add configurable stop shortcut Jan 22, 2026
@shaw-baobao shaw-baobao force-pushed the feat/ctrl-c-interrupt branch from 7ef0161 to 1074989 Compare January 22, 2026 05:59
Copy link

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 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 interruptShortcut setting with "ctrl+c" as the default across TypeScript and Rust type systems
  • Created useInterruptShortcut hook 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.

@Dimillian
Copy link
Owner

What about Linux and Windows where CTRL-C is copy?

@shaw-baobao
Copy link
Contributor Author

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.

@Dimillian Dimillian closed this Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants