tauri-app: spawn record-daemon on startup if not present
record-daemon / Build, check and test (push) Successful in 2m14s

This commit is contained in:
2026-05-17 01:11:46 +02:00
parent c61b79e84b
commit 5f967f0393
3 changed files with 186 additions and 2 deletions
+23
View File
@@ -395,6 +395,28 @@ fn get_video_metadata(video_path: String) -> Result<Value, String> {
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.setup(|app| {
// Auto-start the record-daemon on app launch.
// We spawn a background task so the UI isn't blocked while the
// daemon boots (it can take a few seconds to initialise OBS).
let handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
match daemon_ipc::ensure_daemon_running(30).await {
Ok(true) => {
eprintln!("[tauri] record-daemon is running");
}
Ok(false) => {
eprintln!("[tauri] record-daemon did not become ready within the timeout");
}
Err(e) => {
eprintln!("[tauri] failed to start record-daemon: {}", e);
}
}
// Drop the handle no further use
drop(handle);
});
Ok(())
})
.invoke_handler(tauri::generate_handler![
get_game_history,
get_timeline,
@@ -408,6 +430,7 @@ pub fn run() {
get_video_metadata,
// Daemon IPC commands
daemon_ipc::daemon_is_running,
daemon_ipc::daemon_ensure_running,
daemon_ipc::daemon_get_status,
daemon_ipc::daemon_get_settings,
daemon_ipc::daemon_update_settings,