fix(desktop): improve deeplink action routing and control surface#1806
Open
JYZ-LESLIE wants to merge 2 commits into
Open
fix(desktop): improve deeplink action routing and control surface#1806JYZ-LESLIE wants to merge 2 commits into
JYZ-LESLIE wants to merge 2 commits into
Conversation
Comment on lines
+195
to
+199
| DeepLinkAction::TakeScreenshot { capture_mode } => { | ||
| let capture_target = capture_target_from_mode(capture_mode)?; | ||
| let path = crate::recording::take_screenshot(app.clone(), capture_target).await?; | ||
| write_raycast_screenshot_result(app, path).await | ||
| } |
Contributor
There was a problem hiding this comment.
Blocking OS calls on async thread in
TakeScreenshot
capture_target_from_mode calls list_displays() / list_windows() — synchronous system APIs — directly on the Tokio runtime thread. refresh_raycast_device_cache wraps the identical calls in spawn_blocking specifically to avoid stalling the runtime, but the same protection is missing here. On a system with many windows, list_windows() can take tens of milliseconds and will block the entire runtime thread for the duration.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/deeplink_actions.rs
Line: 195-199
Comment:
**Blocking OS calls on async thread in `TakeScreenshot`**
`capture_target_from_mode` calls `list_displays()` / `list_windows()` — synchronous system APIs — directly on the Tokio runtime thread. `refresh_raycast_device_cache` wraps the identical calls in `spawn_blocking` specifically to avoid stalling the runtime, but the same protection is missing here. On a system with many windows, `list_windows()` can take tens of milliseconds and will block the entire runtime thread for the duration.
How can I resolve this? If you propose a fix, please make it concise.
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.
/claim #1540
This is a focused desktop-side quality pass for the deeplink/Raycast control surface.
What changed
cap-desktop://action?...parsing by using the deeplink host (host_str) so action links are no longer rejectedpause_recordingresume_recordingtoggle_pause_recordingrestart_recordingtake_screenshotset_microphone(withswitch_microphonealias)set_camera(withswitch_cameraalias)refresh_raycast_device_cacheraycast-device-cache.jsonraycast-last-screenshot.jsonspawn_blockingand writing files with async FS APIscap-desktop://signin)Notes
SetCamerausesskip_camera_window=trueso deeplink-triggered device changes do not force camera preview UI popups.Validation
cargo fmt/cargo testin this environment because Rust (cargo) is unavailable on the runner.deeplink_actions.rsfor the changed payload surface.Demo
Greptile Summary
This PR fixes the long-standing
url.domain()→url.host_str()bug that caused allcap-desktop://action?...deeplinks to be rejected, and wires up eight new recording-control actions (pause_recording,resume_recording,toggle_pause_recording,restart_recording,take_screenshot,set_microphone/switch_microphone,set_camera/switch_camera,refresh_raycast_device_cache) to their existing Rust backend handlers.host_str()is the right method for custom-scheme URLs and theNotActionguard now correctly passes through non-action links likecap-desktop://signin.refresh_raycast_device_cacheproperly offloads blocking device-enumeration calls intospawn_blocking, and writes the cache/screenshot-result artifacts viatokio::fs; parser unit tests cover all new variants including serde aliases and nullable payloads.capture_target_from_mode(shared byStartRecordingand the newTakeScreenshotpath) still callslist_displays()/list_windows()directly on the async runtime thread, inconsistent with thespawn_blockingdiscipline applied elsewhere in this PR.Confidence Score: 4/5
Safe to merge; the URL-parsing fix and new action wiring are correct. The one issue (blocking OS calls in TakeScreenshot) mirrors a pre-existing pattern in StartRecording and will not cause data loss or crashes — it may only cause minor runtime latency on systems with many open windows.
The URL-parsing regression fix is well-scoped and correct. New actions delegate to existing, tested backend functions. The spawn_blocking discipline is applied in refresh_raycast_device_cache but not carried through to capture_target_from_mode, which is used by the new TakeScreenshot path — a quality inconsistency rather than a correctness problem.
apps/desktop/src-tauri/src/deeplink_actions.rs — specifically the TakeScreenshot arm and capture_target_from_mode
Important Files Changed
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix(desktop): improve deeplink action ro..." | Re-trigger Greptile