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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(vision): demote overlay apps from focused status on macOS
Louis Beaumont22bcb8f9026a
diff --git a/Cargo.lock b/Cargo.lockindex 60cd0cd2e..5874ec4bb 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -6628,7 +6628,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","bytemuck",@@ -6681,7 +6681,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.60"+version = "0.3.61"dependencies = ["accessibility","accessibility-sys",@@ -6732,7 +6732,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","chrono",@@ -6756,7 +6756,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","chrono",@@ -6774,7 +6774,7 @@ dependencies = [[[package]]name = "screenpipe-integrations"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","image",@@ -6789,7 +6789,7 @@ dependencies = [[[package]]name = "screenpipe-server"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","async-trait",@@ -6858,7 +6858,7 @@ dependencies = [[[package]]name = "screenpipe-vision"-version = "0.3.60"+version = "0.3.61"dependencies = ["accessibility-sys","anyhow",@@ -6870,6 +6870,7 @@ dependencies = ["cidre 0.14.0","clap","core-foundation 0.10.0",+ "core-graphics","criterion","futures-util","image",diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex 2f268d342..4dc16e600 100755--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -9007,7 +9007,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.0.266"+version = "2.0.267"dependencies = ["anyhow","async-stream",@@ -9089,7 +9089,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","bytemuck",@@ -9137,7 +9137,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.60"+version = "0.3.61"dependencies = ["accessibility","accessibility-sys",@@ -9188,7 +9188,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","chrono",@@ -9212,7 +9212,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","chrono",@@ -9228,7 +9228,7 @@ dependencies = [[[package]]name = "screenpipe-integrations"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","image 0.25.9",@@ -9243,7 +9243,7 @@ dependencies = [[[package]]name = "screenpipe-server"-version = "0.3.60"+version = "0.3.61"dependencies = ["anyhow","async-trait",@@ -9307,7 +9307,7 @@ dependencies = [[[package]]name = "screenpipe-vision"-version = "0.3.60"+version = "0.3.61"dependencies = ["accessibility-sys","anyhow",@@ -9319,6 +9319,7 @@ dependencies = ["cidre 0.14.0","clap","core-foundation 0.10.1",+ "core-graphics 0.24.0","image 0.25.9","image-compare","libc",diff --git a/crates/screenpipe-vision/Cargo.toml b/crates/screenpipe-vision/Cargo.tomlindex 4732a7505..653e0859b 100644--- a/crates/screenpipe-vision/Cargo.toml+++ b/crates/screenpipe-vision/Cargo.toml@@ -96,6 +96,7 @@ libc = "0.2.168"cidre = { git = "https://github.com/yury/cidre.git", features = ["vn", "cv", "cg"] }accessibility-sys = { git = "https://github.com/eiz/accessibility.git", branch = "master" }core-foundation = "0.10"+core-graphics = "0.24"[target.'cfg(target_os = "windows")'.dependencies]xcap = "0.8.1"diff --git a/crates/screenpipe-vision/src/capture_screenshot_by_window.rs b/crates/screenpipe-vision/src/capture_screenshot_by_window.rsindex c5f315921..996f5a106 100644--- a/crates/screenpipe-vision/src/capture_screenshot_by_window.rs+++ b/crates/screenpipe-vision/src/capture_screenshot_by_window.rs@@ -376,72 +376,6 @@ struct WindowData {image_buffer: image::RgbaImage,}-/// Build a map of window_id -> kCGWindowLayer for all on-screen windows.-/// Normal app windows have layer 0; floating panels, overlays, status items-/// and always-on-top windows have layer > 0.-#[cfg(target_os = "macos")]-fn get_window_levels() -> HashMap<u32, i32> {- use core_foundation::base::TCFType;- use core_foundation::number::CFNumber;- use core_foundation::string::CFString;- use core_graphics::window::{- copy_window_info, kCGWindowListOptionOnScreenOnly, kCGWindowListExcludeDesktopElements,- kCGNullWindowID,- };-- let mut levels = HashMap::new();-- let options = kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements;- if let Some(window_list) = copy_window_info(options, kCGNullWindowID) {- let count = unsafe { core_foundation::array::CFArrayGetCount(window_list.as_concrete_TypeRef()) };- for i in 0..count {- unsafe {- let dict_ref = core_foundation::array::CFArrayGetValueAtIndex(- window_list.as_concrete_TypeRef(),- i,- );- if dict_ref.is_null() {- continue;- }- let dict = dict_ref as core_foundation::dictionary::CFDictionaryRef;-- // Get kCGWindowNumber- let num_key = CFString::new("kCGWindowNumber");- let mut value = std::ptr::null();- if core_foundation::dictionary::CFDictionaryGetValueIfPresent(- dict,- num_key.as_concrete_TypeRef() as *const _,- &mut value,- ) != 0 && !value.is_null()- {- let cf_num =- CFNumber::wrap_under_get_rule(value as core_foundation::number::CFNumberRef);- if let Some(window_id) = cf_num.to_i64() {- // Get kCGWindowLayer- let layer_key = CFString::new("kCGWindowLayer");- let mut layer_value = std::ptr::null();- if core_foundation::dictionary::CFDictionaryGetValueIfPresent(- dict,- layer_key.as_concrete_TypeRef() as *const _,- &mut layer_value,- ) != 0 && !layer_value.is_null()- {- let layer_num = CFNumber::wrap_under_get_rule(- layer_value as core_foundation::number::CFNumberRef,- );- if let Some(layer) = layer_num.to_i64() {- levels.insert(window_id as u32, layer as i32);- }- }- }- }- }- }- }-- levels-}-/// Get all visible windows using the appropriate backend#[cfg(target_os = "macos")]fn get_all_windows() -> Result<Vec<WindowData>, Box<dyn Error>> {@@ -691,11 +625,11 @@ pub async fn capture_all_visible_windows(let pid_key = CFString::new("kCGWindowOwnerPID");let mut pid_val = std::ptr::null();- if !core_foundation::dictionary::CFDictionaryGetValueIfPresent(+ if core_foundation::dictionary::CFDictionaryGetValueIfPresent(dict,pid_key.as_concrete_TypeRef() as *const _,&mut pid_val,- ) || pid_val.is_null()+ ) == 0 || pid_val.is_null(){continue;}@@ -712,7 +646,7 @@ pub async fn capture_all_visible_windows(dict,layer_key.as_concrete_TypeRef() as *const _,&mut layer_val,- ) && !layer_val.is_null()+ ) != 0 && !layer_val.is_null(){let layer_num = CFNumber::wrap_under_get_rule(layer_val as core_foundation::number::CFNumberRef,