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: shortcut toggle + live text positioning in embedded mode
Louis Beaumontbbf9ef6b2794
diff --git a/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsxindex 70fa3915e..f2cff11f3 100644--- a/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx+++ b/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx@@ -249,12 +249,12 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({}, [frameContext?.text, textPositions]);// --- Live Text hook (native macOS VisionKit overlay) ---- // In overlay/window mode, attach to the correct NSPanel.- // In embedded mode, VisionKit can't work (it covers the entire NSWindow- // including sidebar/chat), so pass "main" which will fail gracefully- // and the web-based SelectableTextLayer kicks in as fallback.+ // Determine which window/panel to attach VisionKit overlay to.+ // In embedded mode, use the "settings" window (regular WebviewWindow).+ // The overlay is positioned precisely over the frame using absolute+ // coordinates from containerRef + renderedImageInfo.const liveTextWindowLabel = embedded- ? "main"+ ? "settings": settings?.overlayMode === "window" ? "main-window" : "main";const { nativeLiveTextActive } = useLiveText({diff --git a/apps/screenpipe-app-tauri/components/rewind/hooks/use-live-text.ts b/apps/screenpipe-app-tauri/components/rewind/hooks/use-live-text.tsindex 742a95526..b6a2e92d1 100644--- a/apps/screenpipe-app-tauri/components/rewind/hooks/use-live-text.ts+++ b/apps/screenpipe-app-tauri/components/rewind/hooks/use-live-text.ts@@ -27,6 +27,7 @@ export function useLiveText(opts: {highlightDismissed,isMac,windowLabel: windowLabelProp,+ containerRef,} = opts;// Native macOS Live Text overlay (VisionKit ImageAnalysisOverlayView)@@ -40,6 +41,19 @@ export function useLiveText(opts: {const analyzeFailCountRef = useRef(0);+ // Get absolute position within the window (accounts for sidebar, titlebar, etc.)+ const getAbsolutePosition = (info: { offsetX: number; offsetY: number; width: number; height: number }) => {+ const rect = containerRef?.current?.getBoundingClientRect();+ const containerX = rect?.left ?? 0;+ const containerY = rect?.top ?? 0;+ return {+ x: containerX + info.offsetX,+ y: containerY + info.offsetY,+ w: info.width,+ h: info.height,+ };+ };+const windowLabel = windowLabelProp ?? "main";// Re-initialize Live Text when window label changes (different window/panel)@@ -87,10 +101,10 @@ export function useLiveText(opts: {// Use last known position for analyze call, or a default.// Position will be corrected by the update_position effect once layout is ready.const info = renderedInfoRef.current;- const x = info?.offsetX ?? 0;- const y = info?.offsetY ?? 0;- const w = info?.width ?? 800;- const h = info?.height ?? 600;+ const pos = info+ ? getAbsolutePosition(info)+ : { x: 0, y: 0, w: 800, h: 600 };+ const { x, y, w, h } = pos;// Debounce: 150ms — short enough to feel responsive, long enough to skip// intermediate frames during fast scroll. Generation counter in Swift@@ -127,12 +141,8 @@ export function useLiveText(opts: {// Update overlay position on resize or when renderedImageInfo first becomes availableuseEffect(() => {if (!nativeLiveTextActive || !renderedImageInfo) return;- invoke("livetext_update_position", {- x: renderedImageInfo.offsetX,- y: renderedImageInfo.offsetY,- w: renderedImageInfo.width,- h: renderedImageInfo.height,- }).catch(() => {});+ const pos = getAbsolutePosition(renderedImageInfo);+ invoke("livetext_update_position", pos).catch(() => {});}, [nativeLiveTextActive, renderedImageInfo?.offsetX, renderedImageInfo?.offsetY, renderedImageInfo?.width, renderedImageInfo?.height]);// Highlight search terms (native Live Text, macOS 14+)@@ -153,15 +163,15 @@ export function useLiveText(opts: {} else if (debouncedFrame?.frameId) {// Re-analyze to show overlay againconst info = renderedInfoRef.current;+ const pos = info+ ? getAbsolutePosition(info)+ : { x: 0, y: 0, w: 800, h: 600 };const imagePath = isSnapshotFrame && debouncedFrame.filePath? debouncedFrame.filePath: `http://localhost:3030/frames/${debouncedFrame.frameId}`;invoke("livetext_analyze", {imagePath,- x: info?.offsetX ?? 0,- y: info?.offsetY ?? 0,- w: info?.width ?? 800,- h: info?.height ?? 600,+ ...pos,}).catch(() => {});}}, [nativeLiveTextActive, isSearchModalOpen]);diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex c85ad7a10..4665aa08a 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -9162,7 +9162,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.2.74"+version = "2.2.76"dependencies = ["anyhow","arboard",diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.tomlindex eb65a6175..b96c400f6 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.2.75"+version = "2.2.76"description = "24/7 memory for your desktop. 100% local."authors = ["you"]license = ""diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rsindex 59ebba049..ca50e7d18 100755--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs@@ -406,28 +406,21 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),let _ = app.emit("shortcut-show", ());#[cfg(target_os = "macos")]{- use crate::store::SettingsStore;- use crate::window_api::main_label_for_mode;- // Get current mode to find the right window label- let mode = SettingsStore::get(app)- .unwrap_or_default()- .unwrap_or_default()- .overlay_mode;- let label = main_label_for_mode(&mode);-- if let Some(window) = app.get_webview_window(label) {- match window.is_visible() {- Ok(true) => {- info!("window is visible, hiding main window");- hide_main_window(app)- }- _ => {- info!("window is not visible, showing main window");- show_main_window(app, false)- }- }+ // Toggle the settings window (the main app window).+ // Check its visibility directly rather than the overlay panel,+ // since show_main_window/hide_main_window operate on the+ // settings window. The overlay panels ("main"/"main-window")+ // may not exist when the settings window is the primary UI.+ let is_visible = app+ .get_webview_window("settings")+ .and_then(|w| w.is_visible().ok())+ .unwrap_or(false);++ if is_visible {+ info!("settings window is visible, hiding");+ hide_main_window(app)} else {- info!("main window not found for mode '{}', creating it", mode);+ info!("settings window is not visible, showing");show_main_window(app, false)}}