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(app): focus chat input on Cmd+N

Louis Beaumont44ce402a2a3c
diff --git a/apps/screenpipe-app-tauri/app/home/page.tsx b/apps/screenpipe-app-tauri/app/home/page.tsx
index ab49e3805..f58a975b4 100644
--- a/apps/screenpipe-app-tauri/app/home/page.tsx
+++ b/apps/screenpipe-app-tauri/app/home/page.tsx
@@ -411,6 +411,10 @@ function HomeContent() {
e.preventDefault();
setActiveSection("home");
startNewChat();
+ // Focus the chat input. When standalone-chat is already mounted (home→home)
+ // it catches this; when mounting fresh from another section, its on-mount
+ // auto-focus handles it instead.
+ void emit("chat-focus-input", {});
}
};
window.addEventListener("keydown", handler);
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 66688a0f4..ff040c22f 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -3851,6 +3851,15 @@ export function StandaloneChat({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [openConversationLocally]);
+ // Cmd+N / Ctrl+N from home/page emits this so the user can immediately type
+ // after a new chat is created without having to click into the textarea.
+ useEffect(() => {
+ const unlisten = listen("chat-focus-input", () => {
+ inputRef.current?.focus();
+ });
+ return () => { unlisten.then((fn) => fn()); };
+ }, []);
+
// Tell the sidebar which session is current whenever the chat panel
// assigns or resumes a session id. Without this the sidebar wouldn't
// know about session changes initiated inside the chat (in-panel "new",