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

Bump app to v2.0.57

Louis Beaumont77fe4dcec738
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 12d6a16ec..65bbca72b 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 = "2.0.56"
+version = "2.0.57"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/screenpipe-vision/src/capture_screenshot_by_window.rs b/screenpipe-vision/src/capture_screenshot_by_window.rs
index f9f958b8a..93cf7edd4 100644
--- a/screenpipe-vision/src/capture_screenshot_by_window.rs
+++ b/screenpipe-vision/src/capture_screenshot_by_window.rs
@@ -152,6 +152,11 @@ pub struct CapturedWindow {
pub is_focused: bool,
/// Browser URL captured atomically with the screenshot to prevent timing mismatches
pub browser_url: Option<String>,
+ /// Window position and size on screen for coordinate transformation
+ pub window_x: i32,
+ pub window_y: i32,
+ pub window_width: u32,
+ pub window_height: u32,
}
pub struct WindowFilters {
@@ -268,9 +273,17 @@ pub async fn capture_all_visible_windows(
}
};
+ // Get window position and size for coordinate transformation
+ let (window_x, window_y, window_width, window_height) = (
+ window.x().unwrap_or(0),
+ window.y().unwrap_or(0),
+ window.width().unwrap_or(0),
+ window.height().unwrap_or(0),
+ );
+
// Capture image immediately while we have access to the window
match window.capture_image() {
- Ok(buffer) => Some((app_name, title, is_focused, buffer, process_id)),
+ Ok(buffer) => Some((app_name, title, is_focused, buffer, process_id, window_x, window_y, window_width, window_height)),
Err(e) => {
// Expected for overlay windows, protected content, or transparent windows
debug!(
@@ -288,7 +301,7 @@ pub async fn capture_all_visible_windows(
}
// Process the captured data
- for (app_name, window_name, is_focused, buffer, process_id) in windows_data {
+ for (app_name, window_name, is_focused, buffer, process_id, window_x, window_y, window_width, window_height) in windows_data {
// Convert to DynamicImage
let image = DynamicImage::ImageRgba8(
image::ImageBuffer::from_raw(buffer.width(), buffer.height(), buffer.into_raw())
@@ -328,6 +341,10 @@ pub async fn capture_all_visible_windows(
process_id,
is_focused,
browser_url,
+ window_x,
+ window_y,
+ window_width,
+ window_height,
});
}
}
diff --git a/screenpipe-vision/src/core.rs b/screenpipe-vision/src/core.rs
index a97619708..b7cdb130b 100644
--- a/screenpipe-vision/src/core.rs
+++ b/screenpipe-vision/src/core.rs
@@ -338,6 +338,9 @@ pub async fn process_ocr_task(
let mut total_confidence = 0.0;
let mut window_count = 0;
+ // Get screen dimensions for coordinate transformation
+ let (screen_width, screen_height) = image.dimensions();
+
for captured_window in window_images {
let ocr_result = process_window_ocr(
captured_window,
@@ -345,6 +348,8 @@ pub async fn process_ocr_task(
&languages,
&mut total_confidence,
&mut window_count,
+ screen_width,
+ screen_height,
)
.await
.map_err(|e| ContinuousCaptureError::ErrorProcessingOcr(e.to_string()))?;
@@ -377,6 +382,8 @@ async fn process_window_ocr(
languages: &[Language],
total_confidence: &mut f64,
window_count: &mut u32,
+ screen_width: u32,
+ screen_height: u32,
) -> Result<WindowOcrResult, ContinuousCaptureError> {
// Use the browser URL that was captured atomically with the screenshot
// This prevents timing mismatches where URL is fetched after browser navigation
@@ -394,12 +401,24 @@ async fn process_window_ocr(
*window_count += 1;
}
+ // Parse the OCR JSON and transform coordinates from window-relative to screen-relative
+ let parsed_json = parse_json_output(&window_json_output);
+ let transformed_json = transform_ocr_coordinates_to_screen(
+ parsed_json,
+ captured_window.window_x,
+ captured_window.window_y,
+ captured_window.window_width,
+ captured_window.window_height,
+ screen_width,
+ screen_height,
+ );
+
Ok(WindowOcrResult {
image: captured_window.image,
window_name: captured_window.window_name,
app_name: captured_window.app_name,
text: window_text,
- text_json: parse_json_output(&window_json_output),
+ text_json: transformed_json,
focused: captured_window.is_focused,
confidence: confidence.unwrap_or(0.0),
browser_url,