feat(desktop): extend deeplinks + add Raycast extension scaffold#1620
Open
cococlaw wants to merge 2 commits intoCapSoftware:mainfrom
Open
feat(desktop): extend deeplinks + add Raycast extension scaffold#1620cococlaw wants to merge 2 commits intoCapSoftware:mainfrom
cococlaw wants to merge 2 commits intoCapSoftware:mainfrom
Conversation
| .flatten() | ||
| .unwrap_or_default(); | ||
|
|
||
| crate::set_mic_input(app.state(), settings.mic_name).await?; |
There was a problem hiding this comment.
settings.mic_name / settings.camera_id move out of settings, so using settings.mode/target/... afterwards becomes a partial-move and won’t compile.
Suggested change
| crate::set_mic_input(app.state(), settings.mic_name).await?; | |
| let settings = crate::recording_settings::RecordingSettingsStore::get(app) | |
| .ok() | |
| .flatten() | |
| .unwrap_or_default(); | |
| let crate::recording_settings::RecordingSettingsStore { | |
| target, | |
| mic_name, | |
| camera_id, | |
| mode: saved_mode, | |
| system_audio, | |
| organization_id, | |
| } = settings; | |
| crate::set_mic_input(app.state(), mic_name).await?; | |
| crate::set_camera_input(app.clone(), app.state(), camera_id, None).await?; | |
| let inputs = StartRecordingInputs { | |
| mode: mode.or(saved_mode).unwrap_or(RecordingMode::Studio), | |
| capture_target: target.unwrap_or_else(|| { | |
| ScreenCaptureTarget::Display { | |
| id: Display::primary().id(), | |
| } | |
| }), | |
| capture_system_audio: system_audio, | |
| organization_id, | |
| }; |
|
|
||
| type DeepLinkAction = string | Record<string, unknown>; | ||
|
|
||
| export async function runDeepLinkAction(action: DeepLinkAction, successMessage: string) { |
There was a problem hiding this comment.
open() can fail (e.g., scheme not registered / Cap not installed), but we always show a success HUD. Maybe wrap in a try/catch and show a failure message.
Suggested change
| export async function runDeepLinkAction(action: DeepLinkAction, successMessage: string) { | |
| export async function runDeepLinkAction(action: DeepLinkAction, successMessage: string) { | |
| const value = JSON.stringify(action); | |
| const deeplink = `cap-desktop://action?value=${encodeURIComponent(value)}`; | |
| await closeMainWindow(); | |
| try { | |
| await open(deeplink); | |
| await showHUD(successMessage); | |
| } catch { | |
| await showHUD("Failed to open Cap"); | |
| } | |
| } |
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.
Implements #1540 by extending desktop deeplink actions and adding an initial Raycast extension scaffold.
/claim #1540
What’s included
start_current_recordingpause_recordingresume_recordingswitch_microphone(optional label, rotate when null)switch_camera(optional selector, rotate when null)cap-desktop://action?value=...host handling.deeplink_actions.rs.apps/desktop/src-tauri/DEEPLINKS.md.extensions/raycastwith commands:extensions/*.Notes
pnpm --dir extensions/raycast typecheck).Greptile Summary
Extended desktop deeplink actions to support recording controls (pause/resume) and device switching (microphone/camera with rotation), and added a Raycast extension scaffold with 6 commands that invoke these deeplinks.
cap-desktop://action?value=...usinghost_str()instead of onlydomain()start_current_recordingaction that uses saved recording settings fromRecordingSettingsStorenext_item()helper that cycles through available devices when no specific device is providedfind_camera_by_selector()to match cameras by display name, device ID, or model IDrunDeepLinkAction()utility that encodes JSON actions as URL query paramsConfidence Score: 5/5
Important Files Changed
extensions/*to workspace packagesSequence Diagram
sequenceDiagram participant User participant Raycast participant Desktop as Cap Desktop participant Recording as Recording Module User->>Raycast: Execute command Raycast->>Raycast: Build deeplink action JSON Raycast->>Raycast: URL encode as cap-desktop://action?value=... Raycast->>Desktop: Open deeplink URL Desktop->>Desktop: Parse URL and deserialize action alt Recording Control Desktop->>Recording: pause_recording() / resume_recording() Recording-->>Desktop: Result else Device Switching Desktop->>Desktop: Get current device Desktop->>Desktop: List available devices Desktop->>Desktop: Calculate next_item() with rotation Desktop->>Recording: set_mic_input() / set_camera_input() Recording-->>Desktop: Result else Start Current Recording Desktop->>Desktop: Load RecordingSettingsStore Desktop->>Recording: set_mic_input() + set_camera_input() Desktop->>Recording: start_recording() with stored settings Recording-->>Desktop: Result end Desktop-->>Raycast: Success/Error Raycast->>User: Show HUD notificationLast reviewed commit: 112bf3f
(2/5) Greptile learns from your feedback when you react with thumbs up/down!