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 <noreply@anthropic.com>
This commit is contained in:
Wes
2026-04-01 13:53:14 -07:00
committed by GitHub
parent 64eaaa7b4a
commit a0bd7cbf25
+9 -1
View File
@@ -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