Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: multi screenpipe instances

Louis Beaumontc098eabbeb8d
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index b0c441a48..f82bd505e 100755
--- a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -43,6 +43,7 @@ async fn use_cli(
if let Some(child) = state.0.lock().unwrap().take() {
child.kill().map_err(|e| e.to_string())?;
}
+
// hard kill the sidecar on port 3030
let _ = tokio::process::Command::new("pkill")
.arg("-f")
@@ -65,6 +66,13 @@ async fn use_cli(
}
fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
+ // if any screenpipe already running, kill it
+ let _ = tokio::process::Command::new("pkill")
+ .arg("-f")
+ .arg("screenpipe")
+ .output()
+ .await;
+
let sidecar = app.shell().sidecar("screenpipe").unwrap();
let (mut rx, child) = sidecar
.args(["--port", "3030", "--debug"])
@@ -246,14 +254,7 @@ async fn main() {
Ok(())
});
- // tauri::async_runtime::spawn(async move {
- // // hard kill the sidecar on port 3030
- // let _ = tokio::process::Command::new("pkill")
- // .arg("-f")
- // .arg("screenpipe")
- // .output()
- // .await;
- // });
+
// Spawn the sidecar initially
let sidecar_state = app.state::<SidecarState>();