-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Add deeplink actions for recording control + Raycast extension #1567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add deeplink actions for recording control + Raycast extension #1567
Conversation
Closes CapSoftware#1540 New deeplink actions: - pause_recording - resume_recording - toggle_pause_recording - set_microphone - set_camera Raycast extension with commands for all recording controls.
| #[derive(Debug, Serialize, Deserialize)] | ||
| #[serde(rename_all = "snake_case")] | ||
| pub enum DeepLinkAction { | ||
| // Recording controls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: this repo avoids code comments; can we drop the new // ... / /// ... in DeepLinkAction (and the whitespace-only lines) so this stays consistent with the rest of the codebase?
| } | ||
|
|
||
| await closeMainWindow(); | ||
| // Open Cap app - it will show the recording interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: same here—can we remove the new inline comment to stay consistent with the no-comments policy?
| return apps.some(app => app.bundleId === CAP_BUNDLE_ID); | ||
| } | ||
|
|
||
| export async function triggerCapAction(action: object): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typing improvement: object is very broad; Record<string, unknown> avoids accidentally accepting arrays/functions.
| export async function triggerCapAction(action: object): Promise<void> { | |
| export async function triggerCapAction(action: Record<string, unknown>): Promise<void> { |
| @@ -0,0 +1 @@ | |||
| Placeholder - replace with actual Cap icon | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extensions/raycast/assets/command-icon.png is currently a text placeholder, so Raycast won’t be able to load it as an icon. Either commit an actual PNG here (or point package.json’s icon to a real asset).
| | `resume_recording` | Resume paused recording | `cap-desktop://action?value={"resume_recording":null}` | | ||
| | `toggle_pause_recording` | Toggle pause/resume | `cap-desktop://action?value={"toggle_pause_recording":null}` | | ||
| | `set_microphone` | Switch microphone | `cap-desktop://action?value={"set_microphone":{"label":"MacBook Pro Microphone"}}` | | ||
| | `set_camera` | Switch camera | `cap-desktop://action?value={"set_camera":{"device_id":"..."}}}` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs: extra } in the set_camera example URL.
| | `set_camera` | Switch camera | `cap-desktop://action?value={"set_camera":{"device_id":"..."}}}` | | |
| | `set_camera` | Switch camera | `cap-desktop://action?value={"set_camera":{"device_id":"..."}}` | |
Add deeplink actions for recording control + Raycast extension
Closes #1540
Summary
This PR extends Cap's deeplink support to enable full recording control via URL schemes, and includes a complete Raycast extension for quick access.
New Deeplink Actions
Added to
deeplink_actions.rs:pause_recordingcap-desktop://action?value={"pause_recording":null}resume_recordingcap-desktop://action?value={"resume_recording":null}toggle_pause_recordingcap-desktop://action?value={"toggle_pause_recording":null}set_microphonecap-desktop://action?value={"set_microphone":{"label":"MacBook Pro Microphone"}}set_cameracap-desktop://action?value={"set_camera":{"device_id":"..."}}}All new actions call the existing internal functions (
crate::recording::pause_recording, etc.), following the same pattern asStartRecordingandStopRecording.Raycast Extension
Located in
extensions/raycast/with commands:Testing
Checklist
DeepLinkActionenum with new variantsexecute()for each new actionDemo
[Demo video will be added after testing on macOS]
Greptile Overview
Greptile Summary
This PR extends Cap's deeplink support to enable comprehensive recording control via URL schemes and adds a complete Raycast extension for quick access to recording commands.
Key Changes
New Deeplink Actions: Added 5 new variants to the
DeepLinkActionenum indeeplink_actions.rs:PauseRecording,ResumeRecording,TogglePauseRecordingfor recording state controlSetMicrophone,SetCamerafor device switching during recordingImplementation Pattern: All new actions follow the established pattern by delegating to existing internal functions (
crate::recording::pause_recording,crate::set_mic_input, etc.), ensuring consistency with the codebaseRaycast Extension: Complete TypeScript extension with 6 commands (start, stop, pause, resume, toggle pause, open settings) that trigger deeplink actions via URL schemes
URL Scheme Format: Actions use the format
cap-desktop://action?value={JSON}where JSON is the serialized action object (e.g.,{"pause_recording":null})Code Quality
StartRecordingandStopRecordingactionsResult<(), String>returnsConfidence Score: 5/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant Raycast participant DeepLink as cap-desktop:// participant DeepLinkHandler as deeplink_actions.rs participant RecordingModule as recording.rs participant App as Cap Application User->>Raycast: Execute command (e.g., "Pause Recording") Raycast->>Raycast: Check if Cap is installed alt Cap not installed Raycast->>User: Show error toast else Cap installed Raycast->>DeepLink: Open URL with action payload Note over DeepLink: cap-desktop://action?value={"pause_recording":null} DeepLink->>DeepLinkHandler: Parse URL and extract action DeepLinkHandler->>DeepLinkHandler: Deserialize JSON to DeepLinkAction enum DeepLinkHandler->>DeepLinkHandler: Execute action asynchronously alt Recording Control Actions DeepLinkHandler->>RecordingModule: Call pause_recording/resume_recording/toggle_pause_recording RecordingModule->>App: Update recording state App-->>User: Recording paused/resumed else Device Control Actions DeepLinkHandler->>App: Call set_mic_input/set_camera_input App->>App: Switch audio/video device App-->>User: Device switched else Navigation Actions DeepLinkHandler->>App: Call show_window/open_project_from_path App-->>User: Window opened end DeepLinkHandler-->>Raycast: Action completed Raycast->>User: Close Raycast window end(2/5) Greptile learns from your feedback when you react with thumbs up/down!