feat: Add Deeplinks for recording controls and Raycast Extension#1824
feat: Add Deeplinks for recording controls and Raycast Extension#1824pon024587-collab wants to merge 2 commits into
Conversation
| app.state(), | ||
| crate::recording::StartRecordingInputs { | ||
| capture_target: target, | ||
| capture_system_audio: Some(settings.system_audio), |
There was a problem hiding this comment.
Type mismatch: compile error in
StartDefaultRecording
StartRecordingInputs.capture_system_audio is typed as bool (see recording.rs line 515), but this line passes Some(settings.system_audio) which is Option<bool>. This is a type mismatch that will prevent the project from compiling. The Some(...) wrapper must be removed: use capture_system_audio: settings.system_audio instead.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/deeplink_actions.rs
Line: 132
Comment:
**Type mismatch: compile error in `StartDefaultRecording`**
`StartRecordingInputs.capture_system_audio` is typed as `bool` (see `recording.rs` line 515), but this line passes `Some(settings.system_audio)` which is `Option<bool>`. This is a type mismatch that will prevent the project from compiling. The `Some(...)` wrapper must be removed: use `capture_system_audio: settings.system_audio` instead.
How can I resolve this? If you propose a fix, please make it concise.| DeepLinkAction::PauseRecording => { | ||
| let state = app.state::<ArcLock<App>>(); | ||
| let mut app_state = state.write().await; | ||
| if let Some(recording) = app_state.current_recording_mut() { | ||
| recording.pause().await.map_err(|e| e.to_string())?; | ||
| } | ||
| Ok(()) | ||
| } | ||
| DeepLinkAction::ResumeRecording => { | ||
| let state = app.state::<ArcLock<App>>(); | ||
| let mut app_state = state.write().await; | ||
| if let Some(recording) = app_state.current_recording_mut() { | ||
| recording.resume().await.map_err(|e| e.to_string())?; | ||
| } | ||
| Ok(()) |
There was a problem hiding this comment.
Missing
RecordingEvent emissions after pause/resume
The existing Tauri commands pause_recording and resume_recording in recording.rs (lines 1516, 1530) emit RecordingEvent::Paused and RecordingEvent::Resumed after the operation so the UI can update its state. The new deep link handlers call recording.pause() / recording.resume() but omit those event emissions. As a result, triggering pause or resume via a deep link will leave the UI stuck showing the pre-action recording state (e.g. the pause button will still show as active after pausing).
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/deeplink_actions.rs
Line: 179-193
Comment:
**Missing `RecordingEvent` emissions after pause/resume**
The existing Tauri commands `pause_recording` and `resume_recording` in `recording.rs` (lines 1516, 1530) emit `RecordingEvent::Paused` and `RecordingEvent::Resumed` after the operation so the UI can update its state. The new deep link handlers call `recording.pause()` / `recording.resume()` but omit those event emissions. As a result, triggering pause or resume via a deep link will leave the UI stuck showing the pre-action recording state (e.g. the pause button will still show as active after pausing).
How can I resolve this? If you propose a fix, please make it concise.| @@ -0,0 +1,7 @@ | |||
| import { open } from "@raycast/api"; | |||
|
|
|||
| export async function executeCapAction(action: any) { | |||
There was a problem hiding this comment.
Using
any for the action parameter bypasses TypeScript's type checking. Since the action can be either a plain string (for simple actions like "stop_recording") or a structured object (for actions with parameters), a union type provides better safety and documents the API contract.
| export async function executeCapAction(action: any) { | |
| type CapAction = | |
| | string | |
| | { switch_mic: { mic_label: string } } | |
| | { switch_camera: { camera_id: { DeviceID: string } } }; | |
| export async function executeCapAction(action: CapAction) { |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/raycast-extension/src/utils.ts
Line: 3
Comment:
Using `any` for the `action` parameter bypasses TypeScript's type checking. Since the action can be either a plain string (for simple actions like `"stop_recording"`) or a structured object (for actions with parameters), a union type provides better safety and documents the API contract.
```suggestion
type CapAction =
| string
| { switch_mic: { mic_label: string } }
| { switch_camera: { camera_id: { DeviceID: string } } };
export async function executeCapAction(action: CapAction) {
```
How can I resolve this? If you propose a fix, please make it concise.| await executeCapAction({ | ||
| switch_camera: { | ||
| camera_id: { DeviceID: props.arguments.camera_id }, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
DeviceID hardcoded; ModelID cameras are unreachable
The Rust enum DeviceOrModelID has two variants: DeviceID and ModelID. The Raycast command always wraps the user-supplied string as { DeviceID: ... }, so any camera that is identified by a model ID (common for virtual or continuity cameras) cannot be switched to via this command. Consider either accepting the variant as a second argument or documenting that only physical device IDs are supported.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/raycast-extension/src/switch-camera.ts
Line: 4-8
Comment:
**`DeviceID` hardcoded; `ModelID` cameras are unreachable**
The Rust enum `DeviceOrModelID` has two variants: `DeviceID` and `ModelID`. The Raycast command always wraps the user-supplied string as `{ DeviceID: ... }`, so any camera that is identified by a model ID (common for virtual or continuity cameras) cannot be switched to via this command. Consider either accepting the variant as a second argument or documenting that only physical device IDs are supported.
How can I resolve this? If you propose a fix, please make it concise.…nts, and ID types)
Description
This PR implements extended deep link support for recording controls and a new Raycast extension, fulfilling the requirements for issue #1540.
Added Deep Link Actions:
start_default_recording: Starts a recording using the last saved settings.pause_recording: Pauses the active recording.resume_recording: Resumes the paused recording.switch_mic: Switches the microphone input (requiresmic_label).switch_camera: Switches the camera input (requirescamera_idasDeviceOrModelID).Raycast Extension:
apps/raycast-extension.Related Issue
Fixes #1540
Greptile Summary
This PR adds deep link support for five new recording control actions (
start_default_recording,pause_recording,resume_recording,switch_mic,switch_camera) to the Rust backend, and introduces a new Raycast extension that triggers those actions viacap://URLs.StartDefaultRecordinghandler has a compile-breaking type error:capture_system_audioisboolinStartRecordingInputsbut the new code passesSome(settings.system_audio)(Option<bool>), which will prevent the desktop app from building.PauseRecordingandResumeRecordingdeep link handlers skip theRecordingEvent::Paused/RecordingEvent::Resumedemissions that the existing Tauri commands fire, leaving the UI out of sync when these actions are triggered via deep link.switch-cameracommand unconditionally wraps the user input as aDeviceID, making cameras identified byModelIDunreachable via this command.Confidence Score: 2/5
Not safe to merge: the desktop app will fail to compile due to a type mismatch in the new
StartDefaultRecordinghandler, and the pause/resume deep link paths silently skip UI event emissions.The
StartDefaultRecordinghandler passesSome(settings.system_audio)(Option<bool>) into a field typedbool, which is a hard compile error that blocks the entire desktop build. Additionally, the pause/resume handlers omit theRecordingEventemissions that keep the UI in sync, so those actions would silently leave the UI showing stale state even if the compile error were fixed first.apps/desktop/src-tauri/src/deeplink_actions.rsneeds the most attention — fix the type mismatch on line 132 and add the missing event emissions in thePauseRecording/ResumeRecordingarms.Important Files Changed
Option<bool>passed whereboolexpected) and missingRecordingEventemissions in the pause/resume handlers.cap://actiondeep link; usesanytype, losing type safety for the action payload.DeviceID, makingModelID-identified cameras inaccessible.start_default_recordingdeep link action; straightforward and correct.stop_recordingdeep link action; straightforward and correct.pause_recordingdeep link action; correct on the client side.resume_recordingdeep link action; correct on the client side.Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat: add deeplink support for recording..." | Re-trigger Greptile