-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: Bounty: Deeplinks support + Raycast Extension #1765
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ use std::path::{Path, PathBuf}; | |
| use tauri::{AppHandle, Manager, Url}; | ||
| use tracing::trace; | ||
|
|
||
| use crate::{App, ArcLock, recording::StartRecordingInputs, windows::ShowCapWindow}; | ||
| use crate::{App, ArcLock, recording::{InProgressRecording, StartRecordingInputs}, windows::ShowCapWindow}; | ||
|
|
||
| #[derive(Debug, Serialize, Deserialize)] | ||
| #[serde(rename_all = "snake_case")] | ||
|
|
@@ -26,6 +26,22 @@ pub enum DeepLinkAction { | |
| mode: RecordingMode, | ||
| }, | ||
| StopRecording, | ||
| PauseRecording, | ||
| ResumeRecording, | ||
| TogglePauseRecording, | ||
| SetMicrophone { | ||
| label: Option<String>, | ||
| }, | ||
| /// Sets the active camera input for the current recording. | ||
| /// | ||
| /// **Note on field naming**: The JSON key exposed in the deep-link URL is `camera` | ||
| /// (e.g. `cap-desktop://action?value={"set_camera":{"camera":<id>}}`), which maps | ||
| /// to the `id` parameter of the underlying `set_camera_input` Tauri command. | ||
| /// This divergence is intentional to keep the deep-link API readable; the call | ||
| /// site passes `camera` positionally so the mapping is correct at runtime. | ||
| SetCamera { | ||
| camera: Option<DeviceOrModelID>, | ||
| }, | ||
| OpenEditor { | ||
| project_path: PathBuf, | ||
| }, | ||
|
|
@@ -147,6 +163,57 @@ impl DeepLinkAction { | |
| DeepLinkAction::StopRecording => { | ||
| crate::recording::stop_recording(app.clone(), app.state()).await | ||
| } | ||
| DeepLinkAction::PauseRecording => { | ||
| crate::recording::pause_recording(app.clone(), app.state()).await | ||
| } | ||
| DeepLinkAction::ResumeRecording => { | ||
| crate::recording::resume_recording(app.clone(), app.state()).await | ||
| } | ||
| DeepLinkAction::TogglePauseRecording => { | ||
| crate::recording::toggle_pause_recording(app.clone(), app.state()).await | ||
| } | ||
| DeepLinkAction::SetMicrophone { label } => { | ||
| // `set_mic_input` only rewires the active audio feed for Studio-mode | ||
| // recordings. For other modes (Instant/Segment) or when no recording is | ||
| // in progress, the call updates `selected_mic_label` and returns `Ok(())` | ||
| // without changing the live audio path. External callers (e.g. the Raycast | ||
| // extension) should be aware that the change takes effect at the *next* | ||
| // Studio recording start if no Studio session is currently active. | ||
| let is_studio = matches!( | ||
| app.state::<crate::ArcLock<crate::App>>() | ||
| .read() | ||
| .await | ||
| .current_recording(), | ||
| Some(InProgressRecording::Studio { .. }) | ||
| ); | ||
| if !is_studio { | ||
| tracing::warn!( | ||
| "SetMicrophone deeplink: no active Studio recording; \ | ||
| microphone preference saved but audio path not immediately updated" | ||
| ); | ||
| } | ||
| crate::set_mic_input(app.state(), label).await | ||
|
Comment on lines
+175
to
+195
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/desktop/src-tauri/src/deeplink_actions.rs
Line: 168-169
Comment:
**`SetMicrophone` silently succeeds outside Studio recordings**
`set_mic_input` only updates the live mic feed for `InProgressRecording::Studio` mode; for other recording modes (e.g., Instant/Segment) the function updates `selected_mic_label` but does NOT rewire the active recording's audio input. A caller (e.g., the Raycast extension) will receive `Ok(())` even when the microphone wasn't actually switched mid-recording. The same asymmetry exists for `SetCamera`. This matches the in-app UI's behaviour, but it may be surprising for external callers relying on these deeplinks for real-time control. Consider emitting a warning or returning an informational status in those cases.
How can I resolve this? If you propose a fix, please make it concise. |
||
| } | ||
| DeepLinkAction::SetCamera { camera } => { | ||
| // Same caveat as SetMicrophone: camera switching via deeplink only | ||
| // affects the live feed for an active Studio recording. In other modes | ||
| // the preference is persisted but the physical capture source is not | ||
| // immediately swapped. | ||
| let is_studio = matches!( | ||
| app.state::<crate::ArcLock<crate::App>>() | ||
| .read() | ||
| .await | ||
| .current_recording(), | ||
| Some(InProgressRecording::Studio { .. }) | ||
| ); | ||
| if !is_studio { | ||
| tracing::warn!( | ||
| "SetCamera deeplink: no active Studio recording; \ | ||
| camera preference saved but capture source not immediately updated" | ||
| ); | ||
| } | ||
| crate::set_camera_input(app.clone(), app.state(), camera, None).await | ||
| } | ||
| DeepLinkAction::OpenEditor { project_path } => { | ||
| crate::open_project_from_path(Path::new(&project_path), app.clone()) | ||
| } | ||
|
|
||
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.
SetCamerafield name diverges from underlying command parameterThe struct variant uses
camera: Option<DeviceOrModelID>while the underlyingset_camera_inputcommand names the same parameterid. The call site is correct (camerais passed positionally), but the JSON key exposed in the deep-link URL will becamera(due torename_all = "snake_case"), whereas anyone readingset_camera_input's signature would expectid. A brief doc-comment on the variant clarifying the mapping would help future contributors and Raycast extension maintainers.Prompt To Fix With AI