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 ui

Louis Beaumontd3ca8d0f8e1e
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 3264b32f9..bd0075885 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.9"
+version = "0.12.0"
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 085edebca..e5eb95481 100644
--- a/screenpipe-app-tauri/src-tauri/src/sidecar.rs
+++ b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
@@ -285,12 +285,16 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
if enable_ui_monitoring {
args.push("--enable-ui-monitoring");
}
+
+ // Add exe directory path before the Windows-specific block
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 tessdata_path = exe_dir.join("tessdata");
let mut c = app
.shell()
@@ -302,9 +306,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);
- c = c.env("SCREENPIPE_EXE_DIR", exe_dir.display().to_string());
+
+ let c = c.args(&args);
let (_, child) = c.spawn().map_err(|e| {
error!("Failed to spawn sidecar: {}", e);
@@ -322,9 +326,7 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
command = command.env("HF_ENDPOINT", "https://hf-mirror.com");
}
- let mut command = command.args(&args);
-
- command = command.env("SCREENPIPE_EXE_DIR", exe_dir.display().to_string());
+ let command = command.args(&args);
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 3606c57ff..04ad532b1 100644
--- a/screenpipe-vision/src/run_ui_monitoring_macos.rs
+++ b/screenpipe-vision/src/run_ui_monitoring_macos.rs
@@ -1,11 +1,11 @@
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};
use tokio::process::Command;
use tokio::time::{sleep, Duration};
+use which::which;
pub async fn run_ui() -> Result<()> {
info!("starting ui monitoring service...");
@@ -17,9 +17,27 @@ pub async fn run_ui() -> Result<()> {
.join("bin")
.join(binary_name);
+ // If not found, try current directory
+ let current_dir_path = std::env::current_dir()?.join(binary_name);
+
+ // Try the directory of the current executable
+ let exe_dir_path = std::env::current_exe()?
+ .parent()
+ .unwrap_or_else(|| std::path::Path::new("."))
+ .join(binary_name);
+
+ // Try using which
+ let which_path = which(binary_name).ok();
+
// If not found, try tauri location
- let mut ui_monitor_path = if bin_path.exists() {
+ let ui_monitor_path = if bin_path.exists() {
bin_path
+ } else if current_dir_path.exists() {
+ current_dir_path
+ } else if exe_dir_path.exists() {
+ exe_dir_path
+ } else if let Some(path) = which_path {
+ path
} else {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
@@ -29,14 +47,6 @@ 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 {