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: MultiSelect CommandItem value prop, highlight overlay, frame OCR cleanup

Louis Beaumontdfac9b51472f
diff --git a/apps/screenpipe-app-tauri/components/rewind/thumbnail-highlight-overlay.tsx b/apps/screenpipe-app-tauri/components/rewind/thumbnail-highlight-overlay.tsx
index 0ebfa9d8f..6dc90c300 100644
--- a/apps/screenpipe-app-tauri/components/rewind/thumbnail-highlight-overlay.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/thumbnail-highlight-overlay.tsx
@@ -12,7 +12,7 @@ interface ThumbnailHighlightOverlayProps {
}
/**
- * Fetches OCR positions for a thumbnail and renders bright yellow boxes
+ * Fetches OCR positions for a thumbnail and renders yellow boxes
* over matching text blocks. Uses the shared OCR LRU cache so repeated
* views are instant. Percentage-based positioning scales with any size.
*
@@ -32,10 +32,27 @@ export const ThumbnailHighlightOverlay = memo(function ThumbnailHighlightOverlay
.filter((t) => t.length > 0);
if (terms.length === 0) return [];
- return textPositions.filter((pos) => {
+ const matches = textPositions.filter((pos) => {
const textLower = pos.text.toLowerCase();
return terms.some((term) => textLower.includes(term));
});
+
+ // Skip blocks that cover huge areas (paragraph/window level).
+ // Keep anything under 30% width — excludes full-line terminal output
+ // and search-bar text while keeping labels, titles, and short phrases.
+ const tight = matches.filter(
+ (m) => m.bounds.width < 0.30
+ );
+
+ if (tight.length === 0) return [];
+
+ // Take the 5 smallest to keep thumbnails readable
+ tight.sort(
+ (a, b) =>
+ a.bounds.width * a.bounds.height -
+ b.bounds.width * b.bounds.height
+ );
+ return tight.slice(0, 5);
}, [textPositions, highlightTerms]);
if (highlights.length === 0) return null;
@@ -43,22 +60,20 @@ export const ThumbnailHighlightOverlay = memo(function ThumbnailHighlightOverlay
return (
<div className="absolute inset-0 pointer-events-none overflow-hidden z-[1]">
{highlights.map((pos, i) => {
- // Pad the highlight boxes so they're visible at thumbnail scale
- const padX = 0.005; // 0.5% horizontal padding
- const padY = 0.008; // 0.8% vertical padding
+ const padX = 0.005;
+ const padY = 0.008;
return (
<div
key={i}
className="absolute"
style={{
- left: `${Math.max(0, (pos.bounds.left - padX)) * 100}%`,
- top: `${Math.max(0, (pos.bounds.top - padY)) * 100}%`,
+ left: `${Math.max(0, pos.bounds.left - padX) * 100}%`,
+ top: `${Math.max(0, pos.bounds.top - padY) * 100}%`,
width: `${(pos.bounds.width + padX * 2) * 100}%`,
height: `${(pos.bounds.height + padY * 2) * 100}%`,
- backgroundColor: "rgba(250, 204, 21, 0.55)",
- border: "1.5px solid rgba(250, 204, 21, 0.95)",
+ backgroundColor: "rgba(250, 204, 21, 0.35)",
+ border: "1.5px solid rgba(250, 204, 21, 0.7)",
borderRadius: "2px",
- boxShadow: "0 0 4px 1px rgba(250, 204, 21, 0.4)",
}}
/>
);
diff --git a/apps/screenpipe-app-tauri/components/ui/multi-select.tsx b/apps/screenpipe-app-tauri/components/ui/multi-select.tsx
index 518962512..c91f76fd5 100644
--- a/apps/screenpipe-app-tauri/components/ui/multi-select.tsx
+++ b/apps/screenpipe-app-tauri/components/ui/multi-select.tsx
@@ -436,6 +436,7 @@ export const MultiSelect = React.forwardRef<
].map((option) => (
<CommandItem
key={option.value}
+ value={option.value}
onSelect={() => toggleOption(option.value)}
className="cursor-pointer w-full"
>
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index b61882c82..040d69e2f 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -8223,7 +8223,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.2.1"
+version = "2.2.2"
dependencies = [
"anyhow",
"arboard",
diff --git a/crates/screenpipe-server/src/routes/frames.rs b/crates/screenpipe-server/src/routes/frames.rs
index 5ad34637b..c32bc65a0 100644
--- a/crates/screenpipe-server/src/routes/frames.rs
+++ b/crates/screenpipe-server/src/routes/frames.rs
@@ -624,15 +624,15 @@ pub struct FrameOcrResponse {
}
/// Get OCR text positions with bounding boxes for a specific frame.
-/// Falls back to accessibility tree node bounds when no OCR data exists.
-/// This enables text selection overlay on screenshots.
+/// Returns only Apple Vision OCR positions (screen-relative, normalized 0-1).
+/// Accessibility tree bounds are NOT mixed in because they use window-relative
+/// coordinates which don't align with the full-screen capture image.
#[oasgen]
pub async fn get_frame_ocr_data(
State(state): State<Arc<AppState>>,
Path(frame_id): Path<i64>,
) -> Result<JsonResponse<FrameOcrResponse>, (StatusCode, JsonResponse<Value>)> {
- // Get OCR data (bounding boxes from Apple Vision)
- let mut text_positions = match state.db.get_frame_text_positions(frame_id).await {
+ let text_positions = match state.db.get_frame_text_positions(frame_id).await {
Ok(tp) => tp,
Err(e) => {
error!("Failed to get OCR data for frame {}: {}", frame_id, e);
@@ -640,89 +640,6 @@ pub async fn get_frame_ocr_data(
}
};
- // Merge accessibility tree link nodes — they have complete URLs with proper
- // bounds, unlike OCR which often splits URLs across multiple text blocks.
- if let Ok((_, Some(tree_json))) = state.db.get_frame_accessibility_data(frame_id).await {
- if let Ok(nodes) = serde_json::from_str::<Vec<serde_json::Value>>(&tree_json) {
- for n in &nodes {
- let role = n.get("role").and_then(|v| v.as_str()).unwrap_or("");
- let role_lower = role.to_lowercase();
- // Only merge link/hyperlink nodes (they carry full URLs)
- if !role_lower.contains("link") && !role_lower.contains("hyperlink") {
- continue;
- }
- let text = match n.get("text").and_then(|v| v.as_str()) {
- Some(t) if !t.trim().is_empty() => t,
- _ => continue,
- };
- // Must look like a URL
- if !text.trim().starts_with("http://")
- && !text.trim().starts_with("https://")
- && !text.trim().starts_with("www.")
- {
- continue;
- }
- let b = match n.get("bounds") {
- Some(b) => b,
- None => continue,
- };
- let left = b.get("left").and_then(|v| v.as_f64()).unwrap_or(-1.0) as f32;
- let top = b.get("top").and_then(|v| v.as_f64()).unwrap_or(-1.0) as f32;
- let width = b.get("width").and_then(|v| v.as_f64()).unwrap_or(0.0) as f32;
- let height = b.get("height").and_then(|v| v.as_f64()).unwrap_or(0.0) as f32;
- if width <= 0.0 || height <= 0.0 {
- continue;
- }
- text_positions.push(TextPosition {
- text: text.to_string(),
- confidence: 1.0,
- bounds: screenpipe_db::TextBounds {
- left,
- top,
- width,
- height,
- },
- });
- }
- }
- }
-
- // Pure a11y fallback for frames with no OCR at all (already handled above
- // for link nodes, but also grab all text nodes when OCR is empty)
- if text_positions.is_empty() {
- if let Ok((_, Some(tree_json))) = state.db.get_frame_accessibility_data(frame_id).await {
- if let Ok(nodes) = serde_json::from_str::<Vec<serde_json::Value>>(&tree_json) {
- text_positions = nodes
- .iter()
- .filter_map(|n| {
- let text = n.get("text")?.as_str()?;
- if text.trim().is_empty() {
- return None;
- }
- let b = n.get("bounds")?;
- let left = b.get("left")?.as_f64()? as f32;
- let top = b.get("top")?.as_f64()? as f32;
- let width = b.get("width")?.as_f64()? as f32;
- let height = b.get("height")?.as_f64()? as f32;
- if width <= 0.0 || height <= 0.0 {
- return None;
- }
- Some(TextPosition {
- text: text.to_string(),
- confidence: 1.0,
- bounds: screenpipe_db::TextBounds {
- left,
- top,
- width,
- height,
- },
- })
- })
- .collect();
- }
- }
- }
-
Ok(JsonResponse(FrameOcrResponse {
frame_id,
text_positions,