Cap desktop Linux setup#1635
Cap desktop Linux setup#1635richiemcilroy wants to merge 5 commits intocursor/cap-linux-support-8d37from
Conversation
- Updated Rust toolchain from 1.83.0 to 1.93.1 for edition2024 support - Installed libasound2-dev for ALSA audio support - Created symlinks for FFmpeg multiarch headers (libswscale, libavcodec, libavformat, libavutil, libavfilter, libswresample, libavdevice) - Set C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, and LIBRARY_PATH for proper C++ toolchain detection Linux desktop build now compiles and launches successfully, though frontend has module resolution issues preventing full UI functionality. Co-authored-by: Richie McIlroy <[email protected]>
Co-authored-by: Richie McIlroy <[email protected]>
Co-authored-by: Richie McIlroy <[email protected]>
Co-authored-by: Richie McIlroy <[email protected]>
Co-authored-by: Richie McIlroy <[email protected]>
|
Cursor Agent can help with this pull request. Just |
| let Some(windows) = map.get(window.label()) else { | ||
| #[cfg(target_os = "linux")] | ||
| if is_recording_controls { | ||
| window.set_ignore_cursor_events(false).ok(); | ||
| } else { | ||
| window.set_ignore_cursor_events(true).ok(); | ||
| } | ||
|
|
||
| #[cfg(not(target_os = "linux"))] | ||
| window.set_ignore_cursor_events(true).ok(); | ||
| continue; | ||
| }; |
There was a problem hiding this comment.
On Linux, is_recording_controls always continues at L106, so the #[cfg(target_os = "linux")] if is_recording_controls { ... } branch here is effectively dead. This reads a lot simpler as an unconditional set_ignore_cursor_events(true).
| let Some(windows) = map.get(window.label()) else { | |
| #[cfg(target_os = "linux")] | |
| if is_recording_controls { | |
| window.set_ignore_cursor_events(false).ok(); | |
| } else { | |
| window.set_ignore_cursor_events(true).ok(); | |
| } | |
| #[cfg(not(target_os = "linux"))] | |
| window.set_ignore_cursor_events(true).ok(); | |
| continue; | |
| }; | |
| let Some(windows) = map.get(window.label()) else { | |
| window.set_ignore_cursor_events(true).ok(); | |
| continue; | |
| }; |
| #[cfg(target_os = "linux")] | ||
| if is_recording_controls { | ||
| let _ = window.set_ignore_cursor_events(false); | ||
| } else { | ||
| let _ = window.set_ignore_cursor_events(true); | ||
| } | ||
|
|
||
| #[cfg(not(target_os = "linux"))] | ||
| let _ = window.set_ignore_cursor_events(true); |
There was a problem hiding this comment.
Since is_recording_controls already continues above on Linux, this per-OS branching in the error path isn’t doing anything different. Collapsing it reduces branching in the 20fps loop.
| #[cfg(target_os = "linux")] | |
| if is_recording_controls { | |
| let _ = window.set_ignore_cursor_events(false); | |
| } else { | |
| let _ = window.set_ignore_cursor_events(true); | |
| } | |
| #[cfg(not(target_os = "linux"))] | |
| let _ = window.set_ignore_cursor_events(true); | |
| let _ = window.set_ignore_cursor_events(true); |
| let app = app_handle.clone(); | ||
| tokio::spawn(async move { | ||
| let state = | ||
| app.state::<Arc<tokio::sync::RwLock<App>>>().inner().clone(); | ||
| if state.read().await.is_recording_active_or_pending() { | ||
| let _ = recording::stop_recording(app.clone(), app.state()).await; | ||
| } | ||
| }); | ||
| let _ = tray.set_visible(true); |
There was a problem hiding this comment.
tray.set_visible(true) on line 835 executes immediately, even when the spawned task finds an active recording and stops it. The tray visibility should probably be set only after confirming no recording is active.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/tray.rs
Line: 827-835
Comment:
`tray.set_visible(true)` on line 835 executes immediately, even when the spawned task finds an active recording and stops it. The tray visibility should probably be set only after confirming no recording is active.
How can I resolve this? If you propose a fix, please make it concise.| let in_local_bounds = mouse_position.x >= local_x_min | ||
| && mouse_position.x <= local_x_max | ||
| && mouse_position.y >= local_y_min | ||
| && mouse_position.y <= local_y_max; | ||
| let in_global_bounds = mouse_position.x >= global_x_min | ||
| && mouse_position.x <= global_x_max | ||
| && mouse_position.y >= global_y_min | ||
| && mouse_position.y <= global_y_max; |
There was a problem hiding this comment.
Verify whether cursor_position() returns window-relative or global coordinates on Linux - if it's consistently one or the other, the in_local_bounds || in_global_bounds dual check may be unnecessary
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/fake_window.rs
Line: 156-163
Comment:
Verify whether `cursor_position()` returns window-relative or global coordinates on Linux - if it's consistently one or the other, the `in_local_bounds || in_global_bounds` dual check may be unnecessary
How can I resolve this? If you propose a fix, please make it concise.
Enable Cap desktop for Linux to record and edit by fixing module resolution and recording control interactivity.
The
#start/appmodule resolution failed on case-sensitive filesystems, and Linux recording controls were unclickable due to issues with fake-window bounds and stale state, preventing recordings from stopping cleanly and transitioning to the editor.Greptile Summary
This PR enables Linux support for the Cap desktop app by fixing two critical issues: module resolution and recording control interactivity.
Key Changes:
#start/appresolution on case-sensitive Linux filesystems by adding lowercaseapp.tsxre-exportset_ignore_cursor_events(false)in multiple locationsis_recording_active_or_pending()when tray is clickedIssues Found:
tray.rscomment)Confidence Score: 3/5
tray.set_visible(true)executes before confirming recording state, which could cause unexpected UI behavior when stopping recordings from stale state.apps/desktop/src-tauri/src/tray.rs- verify tray visibility behavior when clicking to stop a recordingImportant Files Changed
clear_current_recording()call from pattern matching to prevent stale state issuestray.set_visible(true)may execute prematurely#start/appmodule resolution on case-sensitive Linux filesystemsLast reviewed commit: e168467