Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(tauri): add EditorRecordingTarget and editor window helpers
Richie McIlroya969c565ab25
diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rsindex 0e657af94..46b9d9d06 100644--- a/apps/desktop/src-tauri/src/windows.rs+++ b/apps/desktop/src-tauri/src/windows.rs@@ -3163,3 +3163,33 @@ impl ScreenshotEditorWindowIds {app.state::<ScreenshotEditorWindowIds>().deref().clone()}}++#[derive(Default, Clone)]+pub struct EditorRecordingTarget(pub Arc<Mutex<Option<PathBuf>>>);++impl EditorRecordingTarget {+ pub fn get(app: &AppHandle) -> Self {+ app.state::<EditorRecordingTarget>().deref().clone()+ }++ pub fn set(app: &AppHandle, path: Option<PathBuf>) {+ *Self::get(app).0.lock().unwrap() = path;+ }++ pub fn current(app: &AppHandle) -> Option<PathBuf> {+ Self::get(app).0.lock().unwrap().clone()+ }++ pub fn take(app: &AppHandle) -> Option<PathBuf> {+ Self::get(app).0.lock().unwrap().take()+ }+}++pub fn editor_window_for_path(app: &AppHandle, path: &std::path::Path) -> Option<WebviewWindow> {+ let ids = EditorWindowIds::get(app);+ let id = {+ let guard = ids.ids.lock().unwrap();+ guard.iter().find(|(p, _)| p == path).map(|(_, id)| *id)?+ };+ CapWindowId::Editor { id }.get(app)+}