feat: cancel hands-free recording with Escape#143
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds Escape-key cancellation for hands-free recording: ShortcutManager detects an exact Escape press and emits ChangesEscape Key Cancellation for Hands-Free Recording
Sequence DiagramsequenceDiagram
participant User
participant ShortcutManager as Shortcut Manager
participant RecordingManager as Recording Manager
User->>ShortcutManager: Press Escape key
activate ShortcutManager
ShortcutManager->>ShortcutManager: isEscapePressed() checks exact match
ShortcutManager->>ShortcutManager: emit escape-triggered (on transition)
deactivate ShortcutManager
ShortcutManager->>RecordingManager: escape-triggered event
activate RecordingManager
RecordingManager->>RecordingManager: cancelHandsFreeRecording()
RecordingManager->>RecordingManager: endRecording("escape")
RecordingManager->>RecordingManager: Discard buffered audio / trigger cancellation flow
RecordingManager->>User: Emit recording-cancelled / exit hands-free mode
deactivate RecordingManager
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Pull request overview
Adds an Escape-key cancellation path for hands-free recording in the desktop app, allowing users to discard an in-progress hands-free session and return to idle.
Changes:
- Detect Escape key presses in
ShortcutManagerand emit anescape-triggeredevent with basic debouncing. - Handle
escape-triggeredinRecordingManagerby cancelling an active hands-free recording viaendRecording("escape"). - Extend termination codes to include
"escape".
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/desktop/src/main/managers/shortcut-manager.ts | Adds Escape detection + debounced event emission for cancellation. |
| apps/desktop/src/main/managers/recording-manager.ts | Listens for Escape event and cancels hands-free recordings using a new termination code. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/desktop/src/main/managers/shortcut-manager.ts`:
- Line 16: ESCAPE_KEY_CODES currently mixes macOS and Windows keycodes causing
the Minus key to be treated as Escape; change the constant construction to be
platform-specific (e.g., use process.platform === 'darwin' to include 53 only on
macOS and include 0x1b only on non-macOS/Windows as appropriate) so
isEscapePressed() checks the correct set for the running OS; update the
declaration of ESCAPE_KEY_CODES and any related logic that references it
(ESCAPE_KEY_CODES and isEscapePressed) to use the platform-gated set.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7a5214b7-910c-4a5c-92d5-994bd4d5f5b9
📒 Files selected for processing (2)
apps/desktop/src/main/managers/recording-manager.tsapps/desktop/src/main/managers/shortcut-manager.ts
Summary
Closes #141
Test plan
pnpm type:checkpnpm lint(passes with existing warnings)Summary by CodeRabbit