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

feat: teach global search after first value

Louis Beaumont7d8620dadd36
diff --git a/apps/screenpipe-app-tauri/components/first-run/learning-banner.test.tsx b/apps/screenpipe-app-tauri/components/first-run/learning-banner.test.tsx
index 2c15c9be6..01a769195 100644
--- a/apps/screenpipe-app-tauri/components/first-run/learning-banner.test.tsx
+++ b/apps/screenpipe-app-tauri/components/first-run/learning-banner.test.tsx
@@ -7,7 +7,7 @@ import React from "react";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { FirstRunLearningBanner } from "./learning-banner";
-import { FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY } from "./chat-shortcut-practice";
+import { FIRST_RUN_SEARCH_SHORTCUT_STORAGE_KEY } from "./search-shortcut-practice";
import type { LearningWindowView } from "@/lib/first-run/use-learning-window";
const mocks = vi.hoisted(() => ({
@@ -47,7 +47,7 @@ vi.mock("@/lib/hooks/use-settings", () => ({
useSettings: () => ({
isSettingsLoaded: true,
settings: {
- showChatShortcut: "Control+Super+L",
+ searchShortcut: "Control+Super+K",
disabledShortcuts: [],
platform: "macos",
},
@@ -185,7 +185,7 @@ describe("first-run learning banner", () => {
await waitFor(() =>
expect(
- screen.getByTestId("first-run-chat-shortcut-start"),
+ screen.getByTestId("first-run-search-shortcut-start"),
).toBeEnabled(),
);
@@ -204,7 +204,7 @@ describe("first-run learning banner", () => {
expect(dismiss).toHaveBeenCalledTimes(1);
expect(
JSON.parse(
- window.localStorage.getItem(FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY) ||
+ window.localStorage.getItem(FIRST_RUN_SEARCH_SHORTCUT_STORAGE_KEY) ||
"{}",
),
).toMatchObject({ status: "dismissed" });
diff --git a/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx b/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx
index 31be68656..66fcd6c0b 100644
--- a/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx
+++ b/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx
@@ -22,9 +22,9 @@ import {
} from "@/lib/first-run/use-learning-window";
import { FirstRunNextSteps } from "@/components/first-run/next-steps";
import {
- dismissFirstRunChatShortcutFromParent,
- FirstRunChatShortcutPractice,
-} from "@/components/first-run/chat-shortcut-practice";
+ dismissFirstRunSearchShortcutFromParent,
+ FirstRunSearchShortcutPractice,
+} from "@/components/first-run/search-shortcut-practice";
import type { AgentHandoffTarget } from "@/lib/first-run/agent-handoff";
function CapturedAppIcon({ app }: { app: FirstRunCapturedApp }) {
@@ -296,10 +296,10 @@ export function FirstRunLearningBanner(
data-phase="ready"
className="mx-auto mb-4 w-full max-w-3xl overflow-hidden border border-border bg-background"
>
- <FirstRunChatShortcutPractice />
+ <FirstRunSearchShortcutPractice />
<FirstRunSetupDock
onDismiss={() => {
- dismissFirstRunChatShortcutFromParent();
+ dismissFirstRunSearchShortcutFromParent();
dismiss();
}}
nextSteps={
diff --git a/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.test.tsx b/apps/screenpipe-app-tauri/components/first-run/search-shortcut-practice.test.tsx
similarity index 51%
rename from apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.test.tsx
rename to apps/screenpipe-app-tauri/components/first-run/search-shortcut-practice.test.tsx
index 2c716fa7f..5d856f1b5 100644
--- a/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.test.tsx
+++ b/apps/screenpipe-app-tauri/components/first-run/search-shortcut-practice.test.tsx
@@ -14,12 +14,11 @@ import {
import { beforeEach, describe, expect, it, vi } from "vitest";
import {
- FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY,
- FirstRunChatShortcutPractice,
-} from "./chat-shortcut-practice";
+ FIRST_RUN_SEARCH_SHORTCUT_STORAGE_KEY,
+ FirstRunSearchShortcutPractice,
+} from "./search-shortcut-practice";
type ShortcutOutcome = {
- action: "shown" | "hidden";
success: boolean;
};
@@ -31,7 +30,7 @@ const mocks = vi.hoisted(() => ({
listenerShouldFail: false,
isSettingsLoaded: true,
settings: {
- showChatShortcut: "Control+Super+L",
+ searchShortcut: "Control+Super+K",
disabledShortcuts: [] as string[],
platform: "macos",
},
@@ -71,7 +70,7 @@ const emitOutcome = (outcome: ShortcutOutcome) => {
const waitUntilReady = async () => {
await waitFor(() =>
- expect(screen.getByTestId("first-run-chat-shortcut-start")).toBeEnabled(),
+ expect(screen.getByTestId("first-run-search-shortcut-start")).toBeEnabled(),
);
};
@@ -81,43 +80,45 @@ beforeEach(() => {
mocks.listener = null;
mocks.listenerShouldFail = false;
mocks.isSettingsLoaded = true;
- mocks.settings.showChatShortcut = "Control+Super+L";
+ mocks.settings.searchShortcut = "Control+Super+K";
mocks.settings.disabledShortcuts = [];
mocks.settings.platform = "macos";
});
-describe("first-run chat shortcut practice", () => {
+describe("first-run search shortcut practice", () => {
it("waits for loaded settings and a registered listener", async () => {
mocks.isSettingsLoaded = false;
- const view = render(<FirstRunChatShortcutPractice />);
+ const view = render(<FirstRunSearchShortcutPractice />);
expect(mocks.capture).not.toHaveBeenCalled();
- expect(screen.getByTestId("first-run-chat-shortcut-start")).toBeDisabled();
+ expect(
+ screen.getByTestId("first-run-search-shortcut-start"),
+ ).toBeDisabled();
mocks.isSettingsLoaded = true;
- view.rerender(<FirstRunChatShortcutPractice />);
+ view.rerender(<FirstRunSearchShortcutPractice />);
await waitUntilReady();
- expect(screen.getByText("⌘⌃L")).toBeInTheDocument();
+ expect(screen.getByText("⌘⌃K")).toBeInTheDocument();
expect(mocks.capture).toHaveBeenCalledWith("shortcut_teach_shown", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
exposure_number: 1,
});
});
- it("completes only after native code verifies Chat was shown", async () => {
- render(<FirstRunChatShortcutPractice />);
+ it("completes only after native code verifies Search was shown", async () => {
+ render(<FirstRunSearchShortcutPractice />);
await waitUntilReady();
- fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));
- emitOutcome({ action: "shown", success: true });
+ fireEvent.click(screen.getByTestId("first-run-search-shortcut-start"));
+ emitOutcome({ success: true });
expect(
- screen.getByTestId("first-run-chat-shortcut-complete"),
+ screen.getByTestId("first-run-search-shortcut-complete"),
).toHaveTextContent("shortcut learned");
expect(
JSON.parse(
- window.localStorage.getItem(FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY) ||
+ window.localStorage.getItem(FIRST_RUN_SEARCH_SHORTCUT_STORAGE_KEY) ||
"{}",
),
).toMatchObject({
@@ -128,63 +129,31 @@ describe("first-run chat shortcut practice", () => {
expect(mocks.capture).toHaveBeenCalledWith(
"shortcut_practice_completed",
expect.objectContaining({
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
practice_started: true,
}),
);
});
- it("does not claim success when the shortcut hid an open Chat", async () => {
- render(<FirstRunChatShortcutPractice />);
+ it("offers shortcut settings when Search failed to open", async () => {
+ render(<FirstRunSearchShortcutPractice />);
await waitUntilReady();
- fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));
- emitOutcome({ action: "hidden", success: true });
+ fireEvent.click(screen.getByTestId("first-run-search-shortcut-start"));
+ emitOutcome({ success: false });
expect(
- screen.queryByTestId("first-run-chat-shortcut-complete"),
- ).not.toBeInTheDocument();
- expect(
- screen.getByTestId("first-run-chat-shortcut-issue"),
- ).toHaveTextContent("chat was already open");
- expect(screen.getByTestId("first-run-chat-shortcut-start")).toBeEnabled();
- });
-
- it("shows recovery when an already-open Chat could not be hidden", async () => {
- render(<FirstRunChatShortcutPractice />);
- await waitUntilReady();
- fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));
- emitOutcome({ action: "hidden", success: false });
-
- expect(
- screen.getByTestId("first-run-chat-shortcut-issue"),
- ).toHaveTextContent("chat did not respond");
- expect(mocks.capture).toHaveBeenCalledWith("shortcut_practice_failed", {
- schema_version: 1,
- surface: "first_run_summary",
- shortcut_name: "show_chat",
- reason: "window_not_hidden",
- });
- });
-
- it("offers shortcut settings when Chat failed to open", async () => {
- render(<FirstRunChatShortcutPractice />);
- await waitUntilReady();
- fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));
- emitOutcome({ action: "shown", success: false });
-
- expect(
- screen.getByTestId("first-run-chat-shortcut-issue"),
- ).toHaveTextContent("chat did not respond");
+ screen.getByTestId("first-run-search-shortcut-issue"),
+ ).toHaveTextContent("search did not open");
fireEvent.click(screen.getByRole("button", { name: "change shortcut" }));
expect(mocks.openSettingsWindow).toHaveBeenCalledWith("shortcuts");
});
it("records completion once when a held shortcut repeats", async () => {
- render(<FirstRunChatShortcutPractice />);
+ render(<FirstRunSearchShortcutPractice />);
await waitUntilReady();
- fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));
- emitOutcome({ action: "shown", success: true });
- emitOutcome({ action: "shown", success: true });
+ fireEvent.click(screen.getByTestId("first-run-search-shortcut-start"));
+ emitOutcome({ success: true });
+ emitOutcome({ success: true });
expect(
mocks.capture.mock.calls.filter(
@@ -194,25 +163,25 @@ describe("first-run chat shortcut practice", () => {
});
it("keeps confirmation until the user returns and acknowledges it", async () => {
- const first = render(<FirstRunChatShortcutPractice />);
+ const first = render(<FirstRunSearchShortcutPractice />);
await waitUntilReady();
- emitOutcome({ action: "shown", success: true });
+ emitOutcome({ success: true });
expect(
- screen.getByTestId("first-run-chat-shortcut-complete"),
+ screen.getByTestId("first-run-search-shortcut-complete"),
).toBeInTheDocument();
first.unmount();
- render(<FirstRunChatShortcutPractice />);
+ render(<FirstRunSearchShortcutPractice />);
expect(
- screen.getByTestId("first-run-chat-shortcut-complete"),
+ screen.getByTestId("first-run-search-shortcut-complete"),
).toBeInTheDocument();
- fireEvent.click(screen.getByTestId("first-run-chat-shortcut-done"));
+ fireEvent.click(screen.getByTestId("first-run-search-shortcut-done"));
expect(
- screen.queryByTestId("first-run-chat-shortcut-complete"),
+ screen.queryByTestId("first-run-search-shortcut-complete"),
).not.toBeInTheDocument();
expect(
JSON.parse(
- window.localStorage.getItem(FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY) ||
+ window.localStorage.getItem(FIRST_RUN_SEARCH_SHORTCUT_STORAGE_KEY) ||
"{}",
),
).toMatchObject({ status: "completed", acknowledged: true });
@@ -220,46 +189,48 @@ describe("first-run chat shortcut practice", () => {
it("shows recovery when the native listener is unavailable", async () => {
mocks.listenerShouldFail = true;
- render(<FirstRunChatShortcutPractice />);
+ render(<FirstRunSearchShortcutPractice />);
await waitFor(() =>
expect(
- screen.getByTestId("first-run-chat-shortcut-issue"),
+ screen.getByTestId("first-run-search-shortcut-issue"),
).toHaveTextContent("practice is unavailable"),
);
- expect(screen.getByTestId("first-run-chat-shortcut-start")).toBeDisabled();
+ expect(
+ screen.getByTestId("first-run-search-shortcut-start"),
+ ).toBeDisabled();
});
it("honors not now and does not nag again during the snooze", async () => {
- const first = render(<FirstRunChatShortcutPractice />);
+ const first = render(<FirstRunSearchShortcutPractice />);
await waitUntilReady();
- fireEvent.click(screen.getByTestId("first-run-chat-shortcut-snooze"));
+ fireEvent.click(screen.getByTestId("first-run-search-shortcut-snooze"));
expect(
- screen.queryByTestId("first-run-chat-shortcut-practice"),
+ screen.queryByTestId("first-run-search-shortcut-practice"),
).not.toBeInTheDocument();
first.unmount();
- render(<FirstRunChatShortcutPractice />);
+ render(<FirstRunSearchShortcutPractice />);
expect(
- screen.queryByTestId("first-run-chat-shortcut-practice"),
+ screen.queryByTestId("first-run-search-shortcut-practice"),
).not.toBeInTheDocument();
});
- it("stays absent when Chat shortcuts are disabled", () => {
- mocks.settings.disabledShortcuts = ["showChatShortcut"];
- render(<FirstRunChatShortcutPractice />);
+ it("stays absent when Search shortcuts are disabled", () => {
+ mocks.settings.disabledShortcuts = ["searchShortcut"];
+ render(<FirstRunSearchShortcutPractice />);
expect(
- screen.queryByTestId("first-run-chat-shortcut-practice"),
+ screen.queryByTestId("first-run-search-shortcut-practice"),
).not.toBeInTheDocument();
expect(mocks.capture).not.toHaveBeenCalled();
});
it("keeps telemetry content-free", async () => {
- mocks.settings.showChatShortcut = "Private+Secret+L";
- render(<FirstRunChatShortcutPractice />);
+ mocks.settings.searchShortcut = "Private+Secret+K";
+ render(<FirstRunSearchShortcutPractice />);
await waitUntilReady();
- fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));
- emitOutcome({ action: "shown", success: true });
+ fireEvent.click(screen.getByTestId("first-run-search-shortcut-start"));
+ emitOutcome({ success: true });
const serialized = JSON.stringify(mocks.capture.mock.calls);
expect(serialized).not.toContain("Private");
diff --git a/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.tsx b/apps/screenpipe-app-tauri/components/first-run/search-shortcut-practice.tsx
similarity index 79%
rename from apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.tsx
rename to apps/screenpipe-app-tauri/components/first-run/search-shortcut-practice.tsx
index 273425108..b6f76f994 100644
--- a/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.tsx
+++ b/apps/screenpipe-app-tauri/components/first-run/search-shortcut-practice.tsx
@@ -14,8 +14,8 @@ import { formatShortcutDisplay } from "@/lib/chat-utils";
import { useSettings } from "@/lib/hooks/use-settings";
import { openSettingsWindow } from "@/lib/utils/window";
-export const FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY =
- "screenpipe.first-run.chat-shortcut.v1";
+export const FIRST_RUN_SEARCH_SHORTCUT_STORAGE_KEY =
+ "screenpipe.first-run.search-shortcut.v1";
const PRACTICE_TIMEOUT_MS = 90_000;
const SNOOZE_MS = 24 * 60 * 60 * 1_000;
@@ -29,9 +29,8 @@ type StoredPractice = {
type PracticePhase = "hidden" | "prompt" | "waiting" | "complete";
type ListenerState = "connecting" | "ready" | "failed";
-type PracticeIssue = "already_hidden" | "failed" | "timeout" | "listener";
-type ChatShortcutOutcome = {
- action: "shown" | "hidden";
+type PracticeIssue = "failed" | "timeout" | "listener";
+type SearchShortcutOutcome = {
success: boolean;
};
@@ -41,7 +40,7 @@ function readStoredPractice(): StoredPractice {
}
try {
const raw = window.localStorage.getItem(
- FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY,
+ FIRST_RUN_SEARCH_SHORTCUT_STORAGE_KEY,
);
if (!raw) return { status: "available", exposureCount: 0 };
const parsed = JSON.parse(raw) as Partial<StoredPractice>;
@@ -70,7 +69,7 @@ function readStoredPractice(): StoredPractice {
function writeStoredPractice(value: StoredPractice): void {
try {
window.localStorage.setItem(
- FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY,
+ FIRST_RUN_SEARCH_SHORTCUT_STORAGE_KEY,
JSON.stringify(value),
);
} catch {
@@ -96,7 +95,7 @@ function initialPhase(now = Date.now()): PracticePhase {
return "prompt";
}
-export function dismissFirstRunChatShortcutFromParent(): void {
+export function dismissFirstRunSearchShortcutFromParent(): void {
const stored = readStoredPractice();
if (stored.status === "completed" || stored.status === "dismissed") return;
writeStoredPractice({
@@ -106,13 +105,13 @@ export function dismissFirstRunChatShortcutFromParent(): void {
posthog.capture("shortcut_teach_dismissed", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
dismissal_source: "parent_tips",
final_dismissal: true,
});
}
-export function FirstRunChatShortcutPractice() {
+export function FirstRunSearchShortcutPractice() {
const { settings, isSettingsLoaded } = useSettings();
const [phase, setPhase] = React.useState<PracticePhase>(() => initialPhase());
const [listenerState, setListenerState] =
@@ -129,9 +128,9 @@ export function FirstRunChatShortcutPractice() {
const disabledShortcuts = settings.disabledShortcuts ?? [];
const disabled =
- !settings.showChatShortcut ||
- disabledShortcuts.includes("showChatShortcut") ||
- disabledShortcuts.includes("show_chat");
+ !settings.searchShortcut ||
+ disabledShortcuts.includes("searchShortcut") ||
+ disabledShortcuts.includes("search");
const isMac =
settings.platform === "macos" ||
(settings.platform === "unknown" &&
@@ -139,7 +138,7 @@ export function FirstRunChatShortcutPractice() {
/Mac/.test(navigator.platform));
const shortcut = disabled
? ""
- : formatShortcutDisplay(settings.showChatShortcut, isMac);
+ : formatShortcutDisplay(settings.searchShortcut, isMac);
React.useEffect(() => {
if (
@@ -156,23 +155,19 @@ export function FirstRunChatShortcutPractice() {
posthog.capture("shortcut_teach_shown", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
exposure_number: Math.min(exposureCount, 2),
});
}, [isSettingsLoaded, phase, shortcut]);
React.useEffect(() => {
- if (
- !shouldInstallListenerRef.current ||
- !shortcut ||
- !isSettingsLoaded
- )
+ if (!shouldInstallListenerRef.current || !shortcut || !isSettingsLoaded)
return;
let unlisten: (() => void) | undefined;
let unmounted = false;
setListenerState("connecting");
- void listen<ChatShortcutOutcome>("shortcut-show-chat", (event) => {
+ void listen<SearchShortcutOutcome>("shortcut-show-search", (event) => {
if (
phaseRef.current === "hidden" ||
phaseRef.current === "complete" ||
@@ -180,21 +175,6 @@ export function FirstRunChatShortcutPractice() {
)
return;
- if (event.payload.action === "hidden") {
- practiceStartedAtRef.current = null;
- setIssue(event.payload.success ? "already_hidden" : "failed");
- setPhase("prompt");
- if (!event.payload.success) {
- posthog.capture("shortcut_practice_failed", {
- schema_version: 1,
- surface: "first_run_summary",
- shortcut_name: "show_chat",
- reason: "window_not_hidden",
- });
- }
- return;
- }
-
if (!event.payload.success) {
practiceStartedAtRef.current = null;
setIssue("failed");
@@ -202,7 +182,7 @@ export function FirstRunChatShortcutPractice() {
posthog.capture("shortcut_practice_failed", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
reason: "window_not_shown",
});
return;
@@ -221,7 +201,7 @@ export function FirstRunChatShortcutPractice() {
posthog.capture("shortcut_practice_completed", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
practice_started: practiceStartedAtRef.current !== null,
seconds_to_practice_bucket:
elapsedMs === null
@@ -261,7 +241,7 @@ export function FirstRunChatShortcutPractice() {
posthog.capture("shortcut_practice_timed_out", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
});
setPhase("prompt");
}, PRACTICE_TIMEOUT_MS);
@@ -281,14 +261,14 @@ export function FirstRunChatShortcutPractice() {
posthog.capture("shortcut_practice_acknowledged", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
});
setPhase("hidden");
};
return (
<div
- data-testid="first-run-chat-shortcut-complete"
+ data-testid="first-run-search-shortcut-complete"
aria-live="polite"
className="flex items-center gap-3 border-b border-border px-4 py-3"
>
@@ -300,7 +280,7 @@ export function FirstRunChatShortcutPractice() {
shortcut learned
</p>
<p className="mt-0.5 text-[10px] leading-relaxed text-muted-foreground">
- open chat from anywhere with {shortcut}. this lesson will not show
+ open search from anywhere with {shortcut}. this lesson will not show
again.
</p>
</div>
@@ -308,7 +288,7 @@ export function FirstRunChatShortcutPractice() {
type="button"
size="sm"
variant="ghost"
- data-testid="first-run-chat-shortcut-done"
+ data-testid="first-run-search-shortcut-done"
className="h-7 px-2 text-[9px]"
onClick={acknowledge}
>
@@ -326,7 +306,7 @@ export function FirstRunChatShortcutPractice() {
posthog.capture("shortcut_practice_started", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
});
};
@@ -341,26 +321,24 @@ export function FirstRunChatShortcutPractice() {
posthog.capture("shortcut_teach_dismissed", {
schema_version: 1,
surface: "first_run_summary",
- shortcut_name: "show_chat",
+ shortcut_name: "show_search",
final_dismissal: finalDismissal,
});
setPhase("hidden");
};
const issueCopy =
- issue === "already_hidden"
- ? "chat was already open and is now hidden. press the shortcut again."
- : issue === "timeout"
- ? "nothing happened. check the shortcut or try again."
- : issue === "listener"
- ? "shortcut practice is unavailable in this window."
- : issue === "failed"
- ? "chat did not respond. check the shortcut and try again."
- : null;
+ issue === "timeout"
+ ? "nothing happened. check the shortcut or try again."
+ : issue === "listener"
+ ? "shortcut practice is unavailable in this window."
+ : issue === "failed"
+ ? "search did not open. check the shortcut and try again."
+ : null;
return (
<div
- data-testid="first-run-chat-shortcut-practice"
+ data-testid="first-run-search-shortcut-practice"
className="flex flex-col gap-3 border-b border-border px-4 py-3 sm:flex-row sm:items-center"
>
<span className="flex h-8 w-8 shrink-0 items-center justify-center border border-border text-foreground">
@@ -368,7 +346,7 @@ export function FirstRunChatShortcutPractice() {
</span>
<div className="min-w-0 flex-1">
<p className="font-mono text-xs font-semibold lowercase text-foreground">
- open chat from anywhere
+ find anything from anywhere
</p>
<p className="mt-0.5 text-[10px] leading-relaxed text-muted-foreground">
{phase === "waiting" ? "press" : "use"}{" "}
@@ -382,21 +360,19 @@ export function FirstRunChatShortcutPractice() {
{issueCopy ? (
<div className="mt-1 flex items-center gap-2">
<p
- data-testid="first-run-chat-shortcut-issue"
+ data-testid="first-run-search-shortcut-issue"
role="status"
className="text-[9px] leading-relaxed text-muted-foreground"
>
{issueCopy}
</p>
- {issue !== "already_hidden" ? (
- <button
- type="button"
- className="shrink-0 font-mono text-[9px] underline underline-offset-2"
- onClick={() => void openSettingsWindow("shortcuts")}
- >
- change shortcut
- </button>
- ) : null}
+ <button
+ type="button"
+ className="shrink-0 font-mono text-[9px] underline underline-offset-2"
+ onClick={() => void openSettingsWindow("shortcuts")}
+ >
+ change shortcut
+ </button>
</div>
) : null}
</div>
@@ -406,7 +382,7 @@ export function FirstRunChatShortcutPractice() {
type="button"
size="sm"
variant="outline"
- data-testid="first-run-chat-shortcut-start"
+ data-testid="first-run-search-shortcut-start"
className="h-7 px-2 text-[9px]"
onClick={startPractice}
disabled={listenerState !== "ready"}
@@ -419,7 +395,7 @@ export function FirstRunChatShortcutPractice() {
</Button>
) : (
<span
- data-testid="first-run-chat-shortcut-waiting"
+ data-testid="first-run-search-shortcut-waiting"
role="status"
className="px-2 font-mono text-[9px] uppercase tracking-[0.12em] text-muted-foreground"
>
@@ -430,7 +406,7 @@ export function FirstRunChatShortcutPractice() {
type="button"
size="sm"
variant="ghost"
- data-testid="first-run-chat-shortcut-snooze"
+ data-testid="first-run-search-shortcut-snooze"
className="h-7 px-2 text-[9px]"
onClick={snooze}
>
diff --git a/apps/screenpipe-app-tauri/e2e/specs/first-run-learning-window.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/first-run-learning-window.spec.ts
index 409a9771a..13f1ad717 100644
--- a/apps/screenpipe-app-tauri/e2e/specs/first-run-learning-window.spec.ts
+++ b/apps/screenpipe-app-tauri/e2e/specs/first-run-learning-window.spec.ts
@@ -50,7 +50,7 @@ const seedFlags = E2E_SEED_FLAGS.split(",")
const canRun = seedFlags.includes("onboarding");
const LEARNING_STORAGE_KEY = "screenpipe.first-run.learning-window.v1";
-const CHAT_SHORTCUT_STORAGE_KEY = "screenpipe.first-run.chat-shortcut.v1";
+const SEARCH_SHORTCUT_STORAGE_KEY = "screenpipe.first-run.search-shortcut.v1";
// The app's own E2E account hook (components/app-entitlement-gate.tsx), compiled
// in only for e2e builds. Brain sits behind the account gate, and no seed flag
// creates a signed-in user, so without this the section never renders.
@@ -349,7 +349,7 @@ const learningState = (over: Record<string, unknown> = {}) => ({
writeSummaryConversation();
await browser.execute((key: string) => {
window.localStorage.removeItem(key);
- }, CHAT_SHORTCUT_STORAGE_KEY);
+ }, SEARCH_SHORTCUT_STORAGE_KEY);
await openHomeWith(
learningState({
phase: "ready",
@@ -394,7 +394,7 @@ const learningState = (over: Record<string, unknown> = {}) => ({
await browser.execute(
() =>
!!document.querySelector(
- '[data-testid="first-run-chat-shortcut-practice"]',
+ '[data-testid="first-run-search-shortcut-practice"]',
),
),
).toBe(true);
@@ -421,7 +421,7 @@ const learningState = (over: Record<string, unknown> = {}) => ({
expect(existsSync(teachScreenshot)).toBe(true);
await (
- await browser.$('[data-testid="first-run-chat-shortcut-start"]')
+ await browser.$('[data-testid="first-run-search-shortcut-start"]')
).click();
await browser.waitUntil(
async () =>
@@ -429,7 +429,7 @@ const learningState = (over: Record<string, unknown> = {}) => ({
await browser.execute(
() =>
!!document.querySelector(
- '[data-testid="first-run-chat-shortcut-waiting"]',
+ '[data-testid="first-run-search-shortcut-waiting"]',
),
),
),
@@ -443,47 +443,14 @@ const learningState = (over: Record<string, unknown> = {}) => ({
);
expect(existsSync(waitingScreenshot)).toBe(true);
- // A toggle that closes an already-visible Chat must not be mistaken for
- // learning the shortcut. The lesson explains the result and asks for one
- // more press, which will now show Chat.
- await emitTauri("shortcut-show-chat", {
- action: "hidden",
- success: true,
- });
- await browser.waitUntil(
- async () =>
- (
- (await browser.execute(
- () =>
- document.querySelector(
- '[data-testid="first-run-chat-shortcut-issue"]',
- )?.textContent ?? "",
- )) as string
- ).includes("already open"),
- {
- timeout: t(10_000),
- timeoutMsg: "hidden Chat outcome was incorrectly accepted",
- },
- );
- const hiddenScreenshot = await saveScreenshot(
- "first-run-summary-shortcut-already-open",
- );
- expect(existsSync(hiddenScreenshot)).toBe(true);
-
- await (
- await browser.$('[data-testid="first-run-chat-shortcut-start"]')
- ).click();
- await emitTauri("shortcut-show-chat", {
- action: "shown",
- success: true,
- });
+ await emitTauri("shortcut-show-search", { success: true });
await browser.waitUntil(
async () =>
Boolean(
await browser.execute(
() =>
!!document.querySelector(
- '[data-testid="first-run-chat-shortcut-complete"]',
+ '[data-testid="first-run-search-shortcut-complete"]',
),
),
),
@@ -500,18 +467,18 @@ const learningState = (over: Record<string, unknown> = {}) => ({
await browser.execute((key: string) => {
const raw = window.localStorage.getItem(key);
return raw ? JSON.parse(raw) : null;
- }, CHAT_SHORTCUT_STORAGE_KEY),
+ }, SEARCH_SHORTCUT_STORAGE_KEY),
).toMatchObject({ status: "completed", acknowledged: false });
const done = await browser.$(
- '[data-testid="first-run-chat-shortcut-done"]',
+ '[data-testid="first-run-search-shortcut-done"]',
);
await done.click();
expect(
await browser.execute((key: string) => {
const raw = window.localStorage.getItem(key);
return raw ? JSON.parse(raw) : null;
- }, CHAT_SHORTCUT_STORAGE_KEY),
+ }, SEARCH_SHORTCUT_STORAGE_KEY),
).toMatchObject({ status: "completed", acknowledged: true });
const toggle = await browser.$('[data-testid="first-run-toggle-setup"]');
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs b/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs
index c0185bb08..fa4f3fb33 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs
@@ -20,47 +20,33 @@ use crate::store::{get_store, SettingsStore};
use crate::window::ShowRewindWindow;
#[derive(Clone, Serialize)]
-struct ChatShortcutOutcome {
- action: &'static str,
+struct SearchShortcutOutcome {
success: bool,
}
-fn chat_transition_succeeded(action: &str, visible: bool) -> bool {
- match action {
- "shown" => visible,
- "hidden" => !visible,
- _ => false,
- }
+fn search_transition_succeeded(visible: bool, focused: bool) -> bool {
+ visible && focused
}
-fn emit_chat_shortcut_outcome_after_settle(app: &AppHandle, action: &'static str) {
+fn emit_search_shortcut_outcome_after_settle(app: &AppHandle) {
let app = app.clone();
tauri::async_runtime::spawn(async move {
tokio::time::sleep(tokio::time::Duration::from_millis(150)).await;
let app_for_check = app.clone();
if let Err(error) = app.run_on_main_thread(move || {
- #[cfg(target_os = "macos")]
- let visible = {
- use tauri_nspanel::ManagerExt;
- app_for_check
- .get_webview_panel("chat")
- .map(|panel| panel.is_visible())
- .unwrap_or(false)
- };
-
- #[cfg(not(target_os = "macos"))]
- let visible = app_for_check
- .get_webview_window("chat")
- .and_then(|window| window.is_visible().ok())
- .unwrap_or(false);
-
- let success = chat_transition_succeeded(action, visible);
- let _ = app_for_check.emit(
- "shortcut-show-chat",
- ChatShortcutOutcome { action, success },
- );
+ let (visible, focused) = app_for_check
+ .get_webview_window("search")
+ .map(|window| {
+ (
+ window.is_visible().unwrap_or(false),
+ window.is_focused().unwrap_or(false),
+ )
+ })
+ .unwrap_or((false, false));
+ let success = search_transition_succeeded(visible, focused);
+ let _ = app_for_check.emit("shortcut-show-search", SearchShortcutOutcome { success });
}) {
- error!("failed to verify chat shortcut outcome: {}", error);
+ error!("failed to verify search shortcut outcome: {}", error);
}
});
}
@@ -348,6 +334,7 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),
let _ = app.run_on_main_thread(move || {
let app = &app_for_closure;
info!("show chat shortcut triggered");
+ let _ = app.emit("shortcut-show-chat", ());
if let Some(_window) = app.get_webview_window("chat") {
#[cfg(target_os = "macos")]
{
@@ -355,7 +342,6 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),
if let Ok(panel) = app.get_webview_panel("chat") {
if panel.is_visible() {
panel.order_out(None);
- emit_chat_shortcut_outcome_after_settle(app, "hidden");
return;
}
}
@@ -364,26 +350,11 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),
{
if _window.is_visible().unwrap_or(false) {
let _ = _window.hide();
- emit_chat_shortcut_outcome_after_settle(app, "hidden");
return;
}
}
}
- #[cfg(target_os = "macos")]
- let existed = app.get_webview_window("chat").is_some();
- match ShowRewindWindow::Chat.show(app) {
- Ok(_) => {
- // A newly created macOS Chat panel starts hidden so it can
- // be configured safely. Reuse the normal existing-window
- // path once to bring that first panel to the foreground.
- #[cfg(target_os = "macos")]
- if !existed {
- let _ = ShowRewindWindow::Chat.show(app);
- }
- }
- Err(error) => error!("failed to show chat from shortcut: {}", error),
- }
- emit_chat_shortcut_outcome_after_settle(app, "shown");
+ let _ = ShowRewindWindow::Chat.show(app);
});
},
)
@@ -396,7 +367,10 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),
let app = &app_for_closure;
info!("search shortcut triggered");
hide_main_window(app.clone());
- let _ = ShowRewindWindow::Search { query: None }.show(app);
+ if let Err(error) = (ShowRewindWindow::Search { query: None }).show(app) {
+ error!("failed to show search from shortcut: {}", error);
+ }
+ emit_search_shortcut_outcome_after_settle(app);
});
})
.await?;
@@ -503,14 +477,13 @@ pub fn parse_shortcut(shortcut_str: &str) -> Result<Shortcut, String> {
#[cfg(test)]
mod tests {
- use super::chat_transition_succeeded;
+ use super::search_transition_succeeded;
#[test]
- fn chat_shortcut_outcome_requires_the_requested_visibility() {
- assert!(chat_transition_succeeded("shown", true));
- assert!(!chat_transition_succeeded("shown", false));
- assert!(chat_transition_succeeded("hidden", false));
- assert!(!chat_transition_succeeded("hidden", true));
- assert!(!chat_transition_succeeded("unknown", true));
+ fn search_shortcut_outcome_requires_visible_focused_search() {
+ assert!(search_transition_succeeded(true, true));
+ assert!(!search_transition_succeeded(true, false));
+ assert!(!search_transition_succeeded(false, true));
+ assert!(!search_transition_succeeded(false, false));
}
}
diff --git a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-already-open.png b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-already-open.png
deleted file mode 100644
index a8ca5621e..000000000
Binary files a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-already-open.png and /dev/null differ
diff --git a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-complete.png b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-complete.png
index df5a24984..5539ae673 100644
Binary files a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-complete.png and b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-complete.png differ
diff --git a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-teach.png b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-teach.png
index 13bdb1cfd..4c7e1e368 100644
Binary files a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-teach.png and b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-teach.png differ
diff --git a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-waiting.png b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-waiting.png
index ed0cd0406..76064d5be 100644
Binary files a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-waiting.png and b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-waiting.png differ