mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
7771592cf2
* feat(shortcuts): add resolveSidePanelToggleIntent pure resolver * feat(shortcuts): Ctrl+W closes the tab directly (drop side-panel priority) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(shortcuts): register toggle-side-panel binding (default ⌘/Ctrl+\) * feat(shortcuts): add side-panel toggle handler + last-panel memory in TerminalLayer * feat(shortcuts): dispatch toggleSidePanel hotkey to TerminalLayer --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
export type CloseIntent =
|
|
| { kind: 'closeTerminal'; sessionId: string }
|
|
| { kind: 'closeWorkspace'; workspaceId: string }
|
|
| { kind: 'closeSingleTab'; sessionId: string }
|
|
| { kind: 'noop' };
|
|
|
|
export interface ResolveCloseInput {
|
|
activeTabId: string | null;
|
|
workspace: { id: string; focusedSessionId?: string } | null;
|
|
sessionForTab: { id: string } | null;
|
|
focusIsInsideTerminal: boolean;
|
|
}
|
|
|
|
export function resolveCloseIntent(input: ResolveCloseInput): CloseIntent {
|
|
const { activeTabId, workspace, sessionForTab, focusIsInsideTerminal } = input;
|
|
|
|
if (!activeTabId) return { kind: 'noop' };
|
|
|
|
if (sessionForTab && !workspace) {
|
|
return { kind: 'closeSingleTab', sessionId: sessionForTab.id };
|
|
}
|
|
|
|
if (!workspace) {
|
|
// e.g. 'vault', 'sftp', or any non-closable pinned tab
|
|
return { kind: 'noop' };
|
|
}
|
|
|
|
const focusedSessionId = workspace.focusedSessionId;
|
|
if (focusedSessionId && focusIsInsideTerminal) {
|
|
return { kind: 'closeTerminal', sessionId: focusedSessionId };
|
|
}
|
|
|
|
return { kind: 'closeWorkspace', workspaceId: workspace.id };
|
|
}
|