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: arrow key app-boundary jump uses getFrameAppName()

Louis Beaumont4c13c571ae11
diff --git a/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx b/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx
index b161111df..a34aab321 100644
--- a/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx
@@ -8,7 +8,7 @@ import { format, isToday, isYesterday } from "date-fns";
import { cn } from "@/lib/utils";
import { commands } from "@/lib/utils/tauri";
import { emit } from "@tauri-apps/api/event";
-import { getCurrentWindow } from "@tauri-apps/api/window";
+
interface SearchModalProps {
isOpen: boolean;
@@ -77,48 +77,20 @@ export function SearchModal({ isOpen, onClose, onNavigateToTimestamp }: SearchMo
resetSearch,
} = useKeywordSearchStore();
- // Focus input when modal opens - use multiple strategies to ensure focus works
+ // Focus input when modal opens
useEffect(() => {
if (isOpen) {
setSelectedIndex(0);
setQuery("");
resetSearch();
- // Multiple focus attempts to handle various timing scenarios
- const focusInput = () => {
- if (inputRef.current) {
- inputRef.current.focus();
- // Also set selection to end of any existing text
- const len = inputRef.current.value.length;
- inputRef.current.setSelectionRange(len, len);
- }
- };
-
- // First, ensure the Tauri window has focus (important for global shortcuts)
- getCurrentWindow().setFocus().catch(() => {});
-
- // Immediate attempt
- focusInput();
-
- // After microtask (React state updates)
- queueMicrotask(focusInput);
-
- // After paint (requestAnimationFrame)
+ // Single rAF is enough — the NSPanel is now made key window
+ // on show, so the input can receive focus immediately.
const rafId = requestAnimationFrame(() => {
- focusInput();
- // And once more after another frame for good measure
- requestAnimationFrame(focusInput);
+ inputRef.current?.focus();
});
- // Fallback with longer delay for Tauri window focus scenarios
- const timer = setTimeout(focusInput, 100);
- const timer2 = setTimeout(focusInput, 200);
-
- return () => {
- cancelAnimationFrame(rafId);
- clearTimeout(timer);
- clearTimeout(timer2);
- };
+ return () => cancelAnimationFrame(rafId);
}
}, [isOpen, resetSearch]);
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
index b45b602aa..c2a3155ac 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -12,7 +12,7 @@ import { addDays, endOfDay, isAfter, isSameDay, startOfDay, subDays } from "date
import { getStartDate } from "@/lib/actions/get-start-date";
import { useTimelineData } from "@/lib/hooks/use-timeline-data";
import { useCurrentFrame } from "@/lib/hooks/use-current-frame";
-import { TimelineSlider } from "@/components/rewind/timeline/timeline";
+import { TimelineSlider, getFrameAppName } from "@/components/rewind/timeline/timeline";
import { useTimelineStore } from "@/lib/hooks/use-timeline-store";
import { hasFramesForDate } from "@/lib/actions/has-frames-date";
import { CurrentFrameTimeline } from "@/components/rewind/current-frame-timeline";
@@ -563,13 +563,15 @@ export default function Timeline() {
});
} else if (dir === "prev-app" || dir === "next-app") {
setCurrentIndex((prev) => {
- const currentApp = frames[prev]?.devices?.[0]?.metadata?.app_name;
+ const currentApp = getFrameAppName(frames[prev]);
+ // prev-app = go back in time = increase index
+ // next-app = go forward in time = decrease index
const step = dir === "prev-app" ? 1 : -1;
let i = prev + step;
- // Skip frames with the same app
+ // Skip frames with the same app to find the boundary
while (i >= 0 && i < frames.length) {
- const app = frames[i]?.devices?.[0]?.metadata?.app_name;
- if (app && app !== currentApp) {
+ const app = getFrameAppName(frames[i]);
+ if (app !== currentApp) {
if (frames[i]) setCurrentFrame(frames[i]);
return i;
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index b469caf6b..c506c9579 100755
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9089,7 +9089,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.96"
+version = "0.3.97"
dependencies = [
"anyhow",
"bytemuck",
@@ -9137,7 +9137,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.96"
+version = "0.3.97"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -9188,7 +9188,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.96"
+version = "0.3.97"
dependencies = [
"anyhow",
"chrono",
@@ -9212,7 +9212,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.96"
+version = "0.3.97"
dependencies = [
"anyhow",
"chrono",
@@ -9228,7 +9228,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.96"
+version = "0.3.97"
dependencies = [
"anyhow",
"image 0.25.9",
@@ -9243,7 +9243,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.96"
+version = "0.3.97"
dependencies = [
"anyhow",
"async-trait",
@@ -9307,7 +9307,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.96"
+version = "0.3.97"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
index b2af7be98..3a4944426 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -377,6 +377,7 @@ impl ShowRewindWindow {
let sharing: u64 = if capturable { 1 } else { 0 };
let _: () = unsafe { msg_send![&*panel, setSharingType: sharing] };
panel.order_front_regardless();
+ panel.make_key_window();
let _ = app_clone.emit("window-focused", true);
}
});
@@ -439,6 +440,7 @@ impl ShowRewindWindow {
NSWindowCollectionBehavior::NSWindowCollectionBehaviorFullScreenAuxiliary
);
panel.order_front_regardless();
+ panel.make_key_window();
let _ = app_clone.emit("window-focused", true);
}
});