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: properly stop screenpipe backend when exiting in non dev mode, add tesseract in linux prebuild, select default devices in ui

Louis Beaumont2589366a0647
diff --git a/examples/apps/screenpipe-app-tauri/components/recording-settings.tsx b/examples/apps/screenpipe-app-tauri/components/recording-settings.tsx
index a46451f8f..18c64c9f3 100644
--- a/examples/apps/screenpipe-app-tauri/components/recording-settings.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/recording-settings.tsx
@@ -70,10 +70,8 @@ export function RecordingSettings({
}
);
if (!monitorsResponse.ok) {
- console.log("monitorsResponse", monitorsResponse);
throw new Error("Failed to fetch monitors");
}
- console.log("monitorsResponse", monitorsResponse);
const monitors: MonitorDevice[] = await monitorsResponse.json();
console.log("monitors", monitors);
setAvailableMonitors(monitors);
@@ -83,20 +81,39 @@ export function RecordingSettings({
"http://localhost:3030/audio/list"
);
if (!audioDevicesResponse.ok) {
- console.log("audioDevicesResponse", audioDevicesResponse);
throw new Error("Failed to fetch audio devices");
}
- console.log("audioDevicesResponse", audioDevicesResponse);
const audioDevices: AudioDevice[] = await audioDevicesResponse.json();
console.log("audioDevices", audioDevices);
setAvailableAudioDevices(audioDevices);
+
+ console.log("localSettings", localSettings);
+ // Update local settings if current values are default
+ if (localSettings.monitorId === "default" && monitors.length > 0) {
+ setLocalSettings({
+ ...localSettings,
+ monitorId: monitors.find((monitor) => monitor.is_default)?.id!,
+ });
+ }
+ if (
+ localSettings.audioDevices.length === 1 &&
+ localSettings.audioDevices[0] === "default" &&
+ audioDevices.length > 0
+ ) {
+ setLocalSettings({
+ ...localSettings,
+ audioDevices: audioDevices
+ .filter((device) => device.is_default)
+ .map((device) => device.name),
+ });
+ }
} catch (error) {
console.error("Failed to load devices:", error);
}
};
loadDevices();
- }, []);
+ }, [localSettings, setLocalSettings]);
const handleUpdate = async () => {
setIsUpdating(true);
@@ -157,7 +174,8 @@ export function RecordingSettings({
{!isUpdating && isDisabled && (
<Card className="p-16 shadow-lg w-fit absolute bottom-1/4 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10 text-center font-bold text-xl mb-4 ">
<CardTitle>
- make sure to start screenpipe recorder once first (go to status)
+ make sure to turn off dev mode and start screenpipe recorder first
+ (go to status)
</CardTitle>
</Card>
)}
diff --git a/examples/apps/screenpipe-app-tauri/scripts/pre_build.js b/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
index c0540d3a7..de61ca03c 100644
--- a/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
+++ b/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
@@ -35,6 +35,7 @@ const config = {
},
linux: {
aptPackages: [
+ 'tesseract',
'ffmpeg',
'libopenblas-dev', // Runtime
'pkg-config',
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 90f5608ff..d5623c343 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.1.51"
+version = "0.1.52"
description = ""
authors = ["you"]
license = ""
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 4fde4103f..98fe76e33 100755
--- a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -425,12 +425,37 @@ async fn main() {
.expect("error while building tauri application");
// Run the app
- app.run(|_app_handle, event| match event {
+ app.run(|app_handle, event| match event {
tauri::RunEvent::Ready { .. } => {
debug!("Ready event");
}
tauri::RunEvent::ExitRequested { .. } => {
debug!("ExitRequested event");
+ // kill all screenpipe processes if the user is not using dev mode using pkill
+ // get dev mode from the store
+ let stores = app_handle.state::<StoreCollection<Wry>>();
+ let path = app_handle
+ .path()
+ .local_data_dir()
+ .unwrap()
+ .join("store.bin");
+ let use_dev_mode = with_store(app_handle.clone(), stores, path, |store| {
+ Ok(store
+ .get("devMode")
+ .unwrap_or(&Value::Bool(false))
+ .as_bool()
+ .unwrap_or(false))
+ })
+ .unwrap_or(false);
+ if !use_dev_mode {
+ tauri::async_runtime::spawn(async move {
+ let _ = tokio::process::Command::new("pkill")
+ .arg("-f")
+ .arg("screenpipe")
+ .output()
+ .await;
+ });
+ }
}
_ => {}
});
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json
index 70908e500..524b86055 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json
@@ -6,6 +6,7 @@
"linux": {
"deb": {
"depends": [
+ "tesseract",
"ffmpeg",
"libopenblas-dev"
]