From a0bd7cbf250a2bee5053b044b36bd5de4bc32de2 Mon Sep 17 00:00:00 2001 From: Wes Date: Wed, 1 Apr 2026 13:53:14 -0700 Subject: [PATCH] Make Cmd+W close the active tab instead of the window (#64) Intercepts the Cmd+W keydown event in the AppShell keyboard handler to close the current active tab via closeAndCleanupTab. When no tab is active, the shortcut is swallowed with no effect. Co-authored-by: Claude Opus 4.6 --- ui/goose2/src/app/AppShell.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/goose2/src/app/AppShell.tsx b/ui/goose2/src/app/AppShell.tsx index a7922706c4..70afa3b73d 100644 --- a/ui/goose2/src/app/AppShell.tsx +++ b/ui/goose2/src/app/AppShell.tsx @@ -383,10 +383,18 @@ export function AppShell({ children }: { children?: React.ReactNode }) { e.preventDefault(); setSidebarCollapsed((prev) => !prev); } + // Cmd+W closes the active tab instead of the window + if (e.key === "w" && e.metaKey) { + e.preventDefault(); + const { activeTabId } = useChatSessionStore.getState(); + if (activeTabId) { + closeAndCleanupTab(activeTabId); + } + } }; window.addEventListener("keydown", handler); return () => window.removeEventListener("keydown", handler); - }, []); + }, [closeAndCleanupTab]); const activeSessionPersonaId = activeTab ? sessionStore.getSession(activeTab.sessionId)?.personaId