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

v2.3.28

Louis Beaumontbdef56a58e2c
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 86b6a3761..efeb85c8e 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.3.27"
+version = "2.3.28"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/crates/screenpipe-audio/src/transcription/engine.rs b/crates/screenpipe-audio/src/transcription/engine.rs
index d09964ecb..24c06963d 100644
--- a/crates/screenpipe-audio/src/transcription/engine.rs
+++ b/crates/screenpipe-audio/src/transcription/engine.rs
@@ -605,6 +605,9 @@ impl TranscriptionSession {
let result = engine
.transcribe_with_sample_rate(audio, sample_rate, opts)
.map_err(|e| anyhow!("{}", e))?;
+ // Free cached Metal buffers after each transcription to prevent
+ // unbounded GPU memory growth from variable-length audio tensors
+ mlx_memory::clear_cache();
Ok(result.text)
}
diff --git a/crates/screenpipe-engine/src/sleep_monitor.rs b/crates/screenpipe-engine/src/sleep_monitor.rs
index fabb04c79..a4d026e38 100644
--- a/crates/screenpipe-engine/src/sleep_monitor.rs
+++ b/crates/screenpipe-engine/src/sleep_monitor.rs
@@ -266,6 +266,65 @@ pub fn start_sleep_monitor() {
}
});
+ // Thread 4: Display reconfiguration watcher.
+ // Detects monitor plug/unplug, mirror mode changes, resolution changes, etc.
+ // Uses CGDisplayRegisterReconfigurationCallback — fires BEFORE and AFTER
+ // each reconfiguration. We only act on the "completion" callback (kCGDisplayBeginConfigurationFlag unset).
+ std::thread::spawn(|| {
+ use std::ffi::c_void;
+
+ type CGDirectDisplayID = u32;
+ type CGDisplayChangeSummaryFlags = u32;
+
+ // kCGDisplayBeginConfigurationFlag = (1 << 0)
+ const K_CG_DISPLAY_BEGIN_CONFIGURATION_FLAG: CGDisplayChangeSummaryFlags = 1;
+
+ #[link(name = "CoreGraphics", kind = "framework")]
+ extern "C" {
+ fn CGDisplayRegisterReconfigurationCallback(
+ callback: unsafe extern "C" fn(
+ display: CGDirectDisplayID,
+ flags: CGDisplayChangeSummaryFlags,
+ user_info: *mut c_void,
+ ),
+ user_info: *mut c_void,
+ ) -> i32; // CGError
+
+ fn CFRunLoopRun();
+ }
+
+ unsafe extern "C" fn on_display_reconfigured(
+ _display: CGDirectDisplayID,
+ flags: CGDisplayChangeSummaryFlags,
+ _user_info: *mut c_void,
+ ) {
+ // Only act on completion (not the "begin" phase)
+ if flags & K_CG_DISPLAY_BEGIN_CONFIGURATION_FLAG != 0 {
+ return;
+ }
+ // Display topology changed — invalidate cached SCStream handles
+ #[cfg(target_os = "macos")]
+ screenpipe_screen::stream_invalidation::request();
+ }
+
+ unsafe {
+ let err = CGDisplayRegisterReconfigurationCallback(
+ on_display_reconfigured,
+ std::ptr::null_mut(),
+ );
+ if err != 0 {
+ // CGError != kCGErrorSuccess — log and continue without this watcher
+ eprintln!("CGDisplayRegisterReconfigurationCallback failed: {}", err);
+ return;
+ }
+ }
+
+ info!("Display reconfiguration watcher registered (CGDisplayRegisterReconfigurationCallback)");
+
+ // The callback is delivered on the run loop of this thread
+ unsafe { CFRunLoopRun(); }
+ });
+
// Thread 3: NSWorkspace notification observers for system sleep/wake.
// These are still useful for the RECENTLY_WOKE flag and telemetry.
std::thread::spawn(move || {