Extend desktop deeplink actions for recording controls#1794
Extend desktop deeplink actions for recording controls#1794liameast43345 wants to merge 5 commits into
Conversation
| None => { | ||
| ShowCapWindow::Main { | ||
| init_target_mode: None, | ||
| } | ||
| .show(app) | ||
| .await?; | ||
| } |
There was a problem hiding this comment.
ShowCapWindow::show returns tauri::Result<WebviewWindow>, and tauri::Error does not implement From<_> for String. Using bare ? here won't compile because the surrounding execute function returns Result<(), String>. Every other call site in this codebase (e.g. show_window in lib.rs) uses .map_err(|e| e.to_string())? to bridge the conversion.
| None => { | |
| ShowCapWindow::Main { | |
| init_target_mode: None, | |
| } | |
| .show(app) | |
| .await?; | |
| } | |
| None => { | |
| ShowCapWindow::Main { | |
| init_target_mode: None, | |
| } | |
| .show(app) | |
| .await | |
| .map_err(|e| e.to_string())?; | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/deeplink_actions.rs
Line: 185-191
Comment:
`ShowCapWindow::show` returns `tauri::Result<WebviewWindow>`, and `tauri::Error` does not implement `From<_> for String`. Using bare `?` here won't compile because the surrounding `execute` function returns `Result<(), String>`. Every other call site in this codebase (e.g. `show_window` in `lib.rs`) uses `.map_err(|e| e.to_string())?` to bridge the conversion.
```suggestion
None => {
ShowCapWindow::Main {
init_target_mode: None,
}
.show(app)
.await
.map_err(|e| e.to_string())?;
}
```
How can I resolve this? If you propose a fix, please make it concise.| #[test] | ||
| fn parses_set_microphone_action() { | ||
| assert!(matches!( | ||
| parse_action("%7B%22set_microphone%22%3A%7B%22mic_label%22%3Anull%7D%7D").unwrap(), | ||
| DeepLinkAction::SetMicrophone { mic_label: None } | ||
| )); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_open_recording_picker_action() { | ||
| assert!(matches!( | ||
| parse_action( | ||
| "%7B%22open_recording_picker%22%3A%7B%22target_mode%22%3A%22display%22%7D%7D" | ||
| ) | ||
| .unwrap(), | ||
| DeepLinkAction::OpenRecordingPicker { | ||
| target_mode: Some(RecordingTargetMode::Display) | ||
| } | ||
| )); | ||
| } |
There was a problem hiding this comment.
Missing test cases for
SetCamera and OpenRecordingPicker { target_mode: None }
The new tests cover RestartRecording, TogglePauseRecording, SetMicrophone (null label), and OpenRecordingPicker (with a mode), but there are no round-trip parse tests for SetCamera (both null and non-null camera values) or for OpenRecordingPicker when target_mode is None. Adding these would match the test coverage level of the other new actions.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/deeplink_actions.rs
Line: 234-253
Comment:
**Missing test cases for `SetCamera` and `OpenRecordingPicker { target_mode: None }`**
The new tests cover `RestartRecording`, `TogglePauseRecording`, `SetMicrophone` (null label), and `OpenRecordingPicker` (with a mode), but there are no round-trip parse tests for `SetCamera` (both null and non-null camera values) or for `OpenRecordingPicker` when `target_mode` is `None`. Adding these would match the test coverage level of the other new actions.
How can I resolve this? If you propose a fix, please make it concise.
Summary
apps/raycastwith no-view commands for Cap recording, settings, picker, microphone, and camera deeplinks.Refs #1540
/claim #1540
Example deeplinks
The existing parser accepts JSON in the
valuequery parameter on theactionhost.Start Studio recording:
cap-desktop://action?value=%7B%22start_recording_from_settings%22%3A%7B%22mode%22%3A%22studio%22%7D%7DStart Instant recording:
cap-desktop://action?value=%7B%22start_recording_from_settings%22%3A%7B%22mode%22%3A%22instant%22%7D%7DPause/resume:
cap-desktop://action?value=%22toggle_pause_recording%22Pause:
cap-desktop://action?value=%22pause_recording%22Resume:
cap-desktop://action?value=%22resume_recording%22Restart:
cap-desktop://action?value=%22restart_recording%22Open picker:
cap-desktop://action?value=%7B%22open_recording_picker%22%3A%7B%22target_mode%22%3A%22display%22%7D%7DClear selected microphone:
cap-desktop://action?value=%7B%22set_microphone%22%3A%7B%22mic_label%22%3Anull%7D%7DClear selected camera:
cap-desktop://action?value=%7B%22set_camera%22%3A%7B%22camera%22%3Anull%7D%7DSet microphone by label:
cap-desktop://action?value=%7B%22set_microphone%22%3A%7B%22mic_label%22%3A%22MacBook%20Pro%20Microphone%22%7D%7DSet camera by device ID:
cap-desktop://action?value=%7B%22set_camera%22%3A%7B%22camera%22%3A%7B%22DeviceID%22%3A%22camera-device-id%22%7D%7D%7DTesting
pnpm --dir apps/raycast exec tsc --noEmitpnpm --dir apps/raycast buildpnpm --dir apps/raycast lintgit diff --checkNot run locally: Rust tests, because this environment does not have
cargoinstalled.Demo video: not attached from this environment because I cannot run the macOS desktop app and Raycast here. The deeplink and Raycast command code paths are included above for maintainer review.