feat(terminal): add keyboard shortcut to toggle expand/collapse (#1180)

Add Cmd/Ctrl+Shift+E shortcut to toggle terminal expand/collapse state.
The shortcut hint is displayed in the expand button tooltip.

Co-authored-by: Test User <test@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Andy
2026-01-16 15:13:34 +01:00
committed by GitHub
parent 51f67c5dd9
commit 1edfe333f6
2 changed files with 9 additions and 2 deletions
@@ -197,12 +197,19 @@ export function Terminal({
e.stopPropagation();
onClose();
}
// Cmd/Ctrl+Shift+E to toggle expand/collapse
if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key.toLowerCase() === 'e') {
e.preventDefault();
e.stopPropagation();
onToggleExpand?.();
}
};
// Use capture phase to get the event before xterm
window.addEventListener('keydown', handleKeyDown, true);
return () => window.removeEventListener('keydown', handleKeyDown, true);
}, [isActive, onClose]);
}, [isActive, onClose, onToggleExpand]);
// Cleanup on unmount
useEffect(() => {
@@ -188,7 +188,7 @@ export function TerminalHeader({
e.stopPropagation();
onToggleExpand();
}}
title={isExpanded ? t('terminal:expand.collapse') : t('terminal:expand.expand')}
title={`${isExpanded ? t('terminal:expand.collapse') : t('terminal:expand.expand')} (${navigator.platform.includes('Mac') ? '⌘' : 'Ctrl'}+Shift+E)`}
>
{isExpanded ? (
<Minimize2 className="h-3.5 w-3.5" />