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

try to fix ui monitoring

Louis Beaumontf6f2a37c1eb1
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index ba25324bb..3264b32f9 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.11.8"
+version = "0.11.9"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-app-tauri/src-tauri/src/sidecar.rs b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
index ab3bda24c..085edebca 100644
--- a/screenpipe-app-tauri/src-tauri/src/sidecar.rs
+++ b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
@@ -41,7 +41,7 @@ pub async fn kill_all_sreenpipes(
}
#[cfg(target_os = "windows")]
{
-use std::os::windows::process::CommandExt;
+ use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x08000000;
tokio::process::Command::new("taskkill")
@@ -285,13 +285,12 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
if enable_ui_monitoring {
args.push("--enable-ui-monitoring");
}
-
+ let exe_dir = env::current_exe()
+ .expect("Failed to get current executable path")
+ .parent()
+ .expect("Failed to get parent directory of executable")
+ .to_path_buf();
if cfg!(windows) {
- let exe_dir = env::current_exe()
- .expect("Failed to get current executable path")
- .parent()
- .expect("Failed to get parent directory of executable")
- .to_path_buf();
let tessdata_path = exe_dir.join("tessdata");
let mut c = app
.shell()
@@ -303,9 +302,9 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
c = c.env("HF_ENDPOINT", "https://hf-mirror.com");
}
+ let mut c = c.args(&args);
-
- let c = c.args(&args);
+ c = c.env("SCREENPIPE_EXE_DIR", exe_dir.display().to_string());
let (_, child) = c.spawn().map_err(|e| {
error!("Failed to spawn sidecar: {}", e);
@@ -323,7 +322,9 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
command = command.env("HF_ENDPOINT", "https://hf-mirror.com");
}
- let command = command.args(&args);
+ let mut command = command.args(&args);
+
+ command = command.env("SCREENPIPE_EXE_DIR", exe_dir.display().to_string());
let result = command.spawn();
if let Err(e) = result {
diff --git a/screenpipe-vision/src/run_ui_monitoring_macos.rs b/screenpipe-vision/src/run_ui_monitoring_macos.rs
index 22b7adf1c..3606c57ff 100644
--- a/screenpipe-vision/src/run_ui_monitoring_macos.rs
+++ b/screenpipe-vision/src/run_ui_monitoring_macos.rs
@@ -1,5 +1,6 @@
use anyhow::Result;
use log::{debug, error, info, warn};
+use std::env;
use std::path::PathBuf;
use std::process::Stdio;
use tokio::io::{AsyncBufReadExt, BufReader};
@@ -17,7 +18,7 @@ pub async fn run_ui() -> Result<()> {
.join(binary_name);
// If not found, try tauri location
- let ui_monitor_path = if bin_path.exists() {
+ let mut ui_monitor_path = if bin_path.exists() {
bin_path
} else {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
@@ -28,6 +29,14 @@ pub async fn run_ui() -> Result<()> {
.join(binary_name)
};
+ if !ui_monitor_path.exists() {
+ let exe_dir = env::var("SCREENPIPE_EXE_DIR").unwrap();
+ let bin_path = PathBuf::from(exe_dir).join("bin").join(binary_name);
+ if bin_path.exists() {
+ ui_monitor_path = bin_path;
+ }
+ }
+
info!("ui_monitor path: {}", ui_monitor_path.display());
loop {