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: Windows overlay positioning + suppress platform-gated warnings
Louis Beaumont50836ac2d056
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rsindex 4ca8a5bcb..c88350913 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -583,6 +583,7 @@ pub async fn show_shortcut_reminder(// Setting Accessory would hide the dock icon which is a worse tradeoff.info!("Creating new shortcut-reminder window");+ #[allow(unused_mut)]let mut builder = WebviewWindowBuilder::new(&app_handle,label,diff --git a/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs b/apps/screenpipe-app-tauri/src-tauri/src/permissions.rsindex 31cc542ad..75ef2115d 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs@@ -1,5 +1,6 @@use serde::{Deserialize, Serialize};use specta::Type;+#[allow(unused_imports)] // used on macOSuse tracing::{info, warn, error};#[derive(Serialize, Deserialize, Type, Clone)]@@ -12,6 +13,7 @@ pub enum OSPermission {#[tauri::command(async)]#[specta::specta]+#[allow(unused_variables)] // permission used on macOSpub fn open_permission_settings(permission: OSPermission) {#[cfg(target_os = "macos")]{@@ -40,6 +42,7 @@ pub fn open_permission_settings(permission: OSPermission) {#[tauri::command]#[specta::specta]+#[allow(unused_variables)] // permission used on macOSpub async fn request_permission(permission: OSPermission) {#[cfg(target_os = "macos")]{@@ -308,6 +311,7 @@ pub fn get_missing_permissions() -> Vec<OSPermission> {#[tauri::command(async)]#[specta::specta]+#[allow(unused_variables)] // initial_check used on macOSpub fn do_permissions_check(initial_check: bool) -> OSPermissionsCheck {#[cfg(target_os = "macos")]{diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rsindex cd45d231b..68e497cfe 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs@@ -743,6 +743,7 @@ pub async fn run(// On Windows, prevent console window from appearing#[cfg(windows)]{+ #[allow(unused_imports)]use std::os::windows::process::CommandExt;const CREATE_NO_WINDOW: u32 = 0x08000000;cmd.creation_flags(CREATE_NO_WINDOW);diff --git a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs b/apps/screenpipe-app-tauri/src-tauri/src/recording.rsindex 9434696d1..f99c7ed9d 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs@@ -287,6 +287,7 @@ pub async fn spawn_screenpipe(/// from previous crashes, CLI runs, etc. Safe because we already verified the port/// is NOT serving a healthy screenpipe (that case returns early above).async fn kill_process_on_port(port: u16) {+ #[allow(unused_variables)] // used only on unixlet my_pid = std::process::id().to_string();#[cfg(unix)]@@ -335,6 +336,7 @@ async fn kill_process_on_port(port: u16) {let mut netstat_cmd = tokio::process::Command::new("cmd");netstat_cmd.args(["/C", &format!("netstat -ano | findstr :{}", port)]);{+ #[allow(unused_imports)]use std::os::windows::process::CommandExt;const CREATE_NO_WINDOW: u32 = 0x08000000;netstat_cmd.creation_flags(CREATE_NO_WINDOW);@@ -366,6 +368,7 @@ async fn kill_process_on_port(port: u16) {let mut kill_cmd = tokio::process::Command::new("taskkill");kill_cmd.args(["/F", "/PID", &pid.to_string()]);{+ #[allow(unused_imports)]use std::os::windows::process::CommandExt;const CREATE_NO_WINDOW: u32 = 0x08000000;kill_cmd.creation_flags(CREATE_NO_WINDOW);diff --git a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs b/apps/screenpipe-app-tauri/src-tauri/src/tray.rsindex 21d9aa0c0..87fa26cf5 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs@@ -70,6 +70,7 @@ pub fn setup_tray(app: &AppHandle, update_item: &tauri::menu::MenuItem<Wry>) ->/// IMPORTANT: NSStatusBar operations must happen on the main thread./// This function dispatches the work to the main thread automatically./// Log the tray icon position for debugging notch visibility issues.+#[allow(dead_code)] // called only on macOSpub fn log_tray_position(app: &AppHandle) {if let Some(tray) = app.tray_by_id("screenpipe_main") {match tray.rect() {@@ -91,6 +92,7 @@ pub fn log_tray_position(app: &AppHandle) {}}+#[allow(dead_code)] // called only on macOSpub fn recreate_tray(app: &AppHandle) {let app_for_thread = app.clone();// Wrap in catch_unwind: ObjC exceptions during tray operations can panicdiff --git a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rsindex 315b3cc69..52b22f23b 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs@@ -124,6 +124,7 @@ pub struct OpenLocalPathPayload {always_on_top: Option<bool>,transparent: Option<bool>,decorations: Option<bool>,+ #[allow(dead_code)] // read only on macOShidden_title: Option<bool>,is_focused: Option<bool>,visible_on_all_workspaces: Option<bool>,@@ -150,6 +151,7 @@ pub async fn show_specific_window(}// NOTE: Accessory mode removed — it hides dock icon and tray on notched MacBookslet url = format!("http://localhost:{}{}", payload.port, payload.path);+ #[allow(unused_mut)]let mut builder = tauri::WebviewWindowBuilder::new(&state.app_handle,&payload.title,@@ -411,6 +413,7 @@ impl ShowRewindWindow {}/// Show an existing Main window (already created for the current mode).+ #[allow(unused_variables)] // label, capturable used only on macOSfn show_existing_main(&self, app: &AppHandle, window: &WebviewWindow, overlay_mode: &str, label: &str) -> tauri::Result<WebviewWindow> {let capturable = SettingsStore::get(app).unwrap_or_default()@@ -679,6 +682,7 @@ impl ShowRewindWindow {.unwrap_or_default().unwrap_or_default();let overlay_mode = settings.overlay_mode;+ #[allow(unused_variables)] // used only on macOSlet show_in_recording = settings.show_overlay_in_screen_recording;// Record what mode we're creating so we can detect changes later*MAIN_CREATED_MODE.lock().unwrap() = overlay_mode.clone();@@ -1095,15 +1099,20 @@ impl ShowRewindWindow {}}tauri::WindowEvent::ScaleFactorChanged { scale_factor: _, new_inner_size: _,.. } => {- // Handle display resolution/scale changes- let Some(monitor) = window_clone.app_handle().primary_monitor().ok().flatten() else {- error!("failed to get primary monitor for scale factor change");+ // Handle display resolution/scale changes — use the window's current monitor+ let Some(monitor) = window_clone.current_monitor().ok().flatten()+ .or_else(|| window_clone.app_handle().primary_monitor().ok().flatten()) else {+ error!("failed to get monitor for scale factor change");return;};let scale_factor = monitor.scale_factor();let size = monitor.size().to_logical::<f64>(scale_factor);- info!("Display scale factor changed, updating window size {:?}", size.clone());- let _ = window_clone.set_size(tauri::Size::Logical(size.clone()));+ let position = monitor.position();+ info!("Display scale factor changed, updating window size {:?} position {:?}", size, position);+ let _ = window_clone.set_size(tauri::Size::Logical(size));+ let _ = window_clone.set_position(tauri::Position::Physical(+ tauri::PhysicalPosition::new(position.x, position.y),+ ));}_ => {}}diff --git a/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs b/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rsindex 60ae865f6..9ba9960ec 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs@@ -9,10 +9,9 @@ use tauri::WebviewWindow;use tracing::{error, info};use windows::Win32::Foundation::HWND;use windows::Win32::UI::WindowsAndMessaging::{- GetWindowLongW, SetWindowLongW, SetWindowPos, GetSystemMetrics,- GWL_EXSTYLE, HWND_TOPMOST, SWP_NOACTIVATE, SWP_SHOWWINDOW,- WS_EX_LAYERED, WS_EX_TRANSPARENT, WS_EX_TOOLWINDOW, WS_EX_NOACTIVATE,- SM_CXSCREEN, SM_CYSCREEN,+ GetWindowLongW, SetWindowLongW, SetWindowPos,+ GWL_EXSTYLE, HWND_TOPMOST, SWP_NOACTIVATE, SWP_SHOWWINDOW, SWP_NOMOVE, SWP_NOSIZE,+ WS_EX_LAYERED, WS_EX_TRANSPARENT, WS_EX_TOOLWINDOW,};/// Extended window styles for overlay behavior@@ -79,24 +78,22 @@ pub fn setup_overlay(window: &WebviewWindow, click_through: bool) -> Result<(),}}- // Get full screen dimensions (including taskbar area)- let screen_width = GetSystemMetrics(SM_CXSCREEN);- let screen_height = GetSystemMetrics(SM_CYSCREEN);-- // Set as topmost window covering the entire screen including taskbar+ // Set as topmost window, keeping Tauri's position and size.+ // Tauri already positioned the window on the correct monitor with+ // proper logical coordinates — don't override with GetSystemMetrics+ // which only returns primary monitor physical pixels and breaks+ // multi-monitor and DPI-scaled setups.let pos_result = SetWindowPos(hwnd,HWND_TOPMOST,- 0, 0, screen_width, screen_height,- SWP_NOACTIVATE | SWP_SHOWWINDOW,+ 0, 0, 0, 0,+ SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE,);if let Err(e) = pos_result {return Err(format!("SetWindowPos failed: {}", e));}- info!("Window positioned at 0,0 with size {}x{}", screen_width, screen_height);-info!("Overlay setup complete - click_through: {}, style: 0x{:X}",click_through, new_style@@ -173,14 +170,12 @@ pub fn bring_to_front(window: &WebviewWindow) -> Result<(), String> {let hwnd = get_hwnd(window).ok_or("Failed to get HWND")?;unsafe {- let screen_width = GetSystemMetrics(SM_CXSCREEN);- let screen_height = GetSystemMetrics(SM_CYSCREEN);-+ // Keep existing position and size — just re-assert TOPMOSTlet result = SetWindowPos(hwnd,HWND_TOPMOST,- 0, 0, screen_width, screen_height,- SWP_NOACTIVATE | SWP_SHOWWINDOW,+ 0, 0, 0, 0,+ SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE,);if let Err(e) = result {diff --git a/crates/screenpipe-server/src/analytics.rs b/crates/screenpipe-server/src/analytics.rsindex 3eb7487ff..f0ada9c84 100644--- a/crates/screenpipe-server/src/analytics.rs+++ b/crates/screenpipe-server/src/analytics.rs@@ -3,8 +3,12 @@ use reqwest::Client;use serde_json::{json, Value};use std::env;use std::sync::atomic::{AtomicBool, Ordering};+use tracing::{debug, error, trace};++#[cfg(target_os = "macos")]use sysinfo::{System, SystemExt};-use tracing::{debug, error, trace, warn};+#[cfg(target_os = "macos")]+use tracing::warn;const POSTHOG_API_KEY: &str = "phc_Bt8GoTBPgkCpDrbaIZzJIEYt0CrJjhBiuLaBck1clce";const POSTHOG_HOST: &str = "https://eu.i.posthog.com";