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: skip full capture cycle on clipboard events to prevent USB input lag

Louis Beaumonteb1d1237185f
diff --git a/crates/screenpipe-engine/src/event_driven_capture.rs b/crates/screenpipe-engine/src/event_driven_capture.rs
index c8d7228bb..df9876958 100644
--- a/crates/screenpipe-engine/src/event_driven_capture.rs
+++ b/crates/screenpipe-engine/src/event_driven_capture.rs
@@ -471,6 +471,21 @@ pub async fn event_driven_capture_loop(
}
if let Some(trigger) = trigger {
+ // Clipboard events don't need a full capture cycle (screenshot +
+ // tree walk + OCR). The clipboard text is already stored by the
+ // UI recorder's input event batch. Triggering a full paired
+ // capture here causes 250-800ms of blocking work (pbpaste +
+ // spawn_blocking tree walk + OCR semaphore) which saturates the
+ // thread pool and causes input lag on USB HID devices.
+ if matches!(trigger, CaptureTrigger::Clipboard) {
+ debug!(
+ "clipboard trigger on monitor {} — skipping capture (text stored via input events)",
+ monitor_id
+ );
+ tokio::time::sleep(poll_interval).await;
+ continue;
+ }
+
// Reset content hash on app/window change so the first frame
// of a new context is never deduped by a stale hash
if matches!(