Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(tauri): add MainWindowReadyState and main-window-ready listener
Richie McIlroyd21cb7017430
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex d591afca8..1f7a4a2c8 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -89,6 +89,7 @@ use std::{},time::{Duration, SystemTime, UNIX_EPOCH},};+use tauri::Listener;use tauri::{AppHandle, Manager, State, Window, WindowEvent, ipc::Channel};use tauri_plugin_deep_link::DeepLinkExt;use tauri_plugin_dialog::DialogExt;@@ -158,6 +159,24 @@ impl AppExitState {}}+pub struct MainWindowReadyState(AtomicBool);++impl Default for MainWindowReadyState {+ fn default() -> Self {+ Self(AtomicBool::new(false))+ }+}++impl MainWindowReadyState {+ pub fn is_ready(&self) -> bool {+ self.0.load(Ordering::Acquire)+ }++ pub fn set_ready(&self, value: bool) {+ self.0.store(value, Ordering::Release);+ }+}+const APP_EXIT_STEP_TIMEOUT: Duration = Duration::from_millis(750);const APP_EXIT_CAMERA_SHUTDOWN_TIMEOUT: Duration = Duration::from_millis(1200);const APP_EXIT_TOTAL_TIMEOUT: Duration = Duration::from_secs(3);@@ -3565,12 +3584,20 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {app.manage(CameraWindowPositionGuard::default());app.manage(CameraWindowOperationLock::default());app.manage(AppExitState::default());+ app.manage(MainWindowReadyState::default());app.manage(Arc::new(RwLock::new(ClipboardContext::new().expect("Failed to create clipboard context"),)));}+ app.listen_any("main-window-ready", {+ let app = app.clone();+ move |_| {+ app.state::<MainWindowReadyState>().set_ready(true);+ }+ });+spawn_mic_error_handler(app.clone(), mic_error_rx);spawn_device_watchers(app.clone());spawn_devices_snapshot_emitter(app.clone());