Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

add Esc hotkey button to shell terminal toolbar

[._.]/ Adam Eivy8e0981411a68
diff --git a/client/src/components/shell/TerminalHotKeys.jsx b/client/src/components/shell/TerminalHotKeys.jsx
index f81fe16056..6837736697 100644
--- a/client/src/components/shell/TerminalHotKeys.jsx
+++ b/client/src/components/shell/TerminalHotKeys.jsx
@@ -1,4 +1,4 @@
-import { OctagonX, ChevronsLeft, ClipboardPaste, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, CornerDownLeft, ChevronsUp, ChevronsDown } from 'lucide-react';
+import { OctagonX, ChevronsLeft, ClipboardPaste, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, CornerDownLeft, ChevronsUp, ChevronsDown, CornerUpLeft } from 'lucide-react';
import ShellImageDrop from './ShellImageDrop';
// Hot buttons for arrow / Enter entry — handy on touch devices and for driving TUI
@@ -32,7 +32,7 @@ export const SCROLL_KEYS = [
//
// `popoverPlacement` is which way the Photo composer opens — 'above' for the
// fullscreen bar, which is pinned to the bottom of the viewport.
-export default function TerminalHotKeys({ sendCtrlB, sendCtrlC, handlePaste, sendNavKey, scrollPage, showPasteInput, setShowPasteInput, pasteInputRef, handlePasteInputEvent, sendImage, popoverPlacement = 'below' }) {
+export default function TerminalHotKeys({ sendCtrlB, sendCtrlC, sendEsc, handlePaste, sendNavKey, scrollPage, showPasteInput, setShowPasteInput, pasteInputRef, handlePasteInputEvent, sendImage, popoverPlacement = 'below' }) {
return (
<>
<button
@@ -53,6 +53,15 @@ export default function TerminalHotKeys({ sendCtrlB, sendCtrlC, handlePaste, sen
<OctagonX size={14} />
<span className="hidden sm:inline">Ctrl+C</span>
</button>
+ <button
+ onClick={sendEsc}
+ className="flex items-center gap-1.5 px-3 py-1.5 bg-port-card hover:bg-port-border text-gray-300 hover:text-white rounded text-xs font-mono transition-colors border border-port-border min-h-[40px] shrink-0"
+ title="Send Escape key"
+ aria-label="Send Escape key"
+ >
+ <CornerUpLeft size={14} />
+ <span className="hidden sm:inline">Esc</span>
+ </button>
<button
onClick={handlePaste}
className="flex items-center gap-1.5 px-3 py-1.5 bg-port-accent/15 hover:bg-port-accent/25 text-port-accent hover:text-port-accent/80 rounded text-xs font-mono transition-colors border border-port-accent/30 min-h-[40px] shrink-0"
diff --git a/client/src/hooks/useShellSession.js b/client/src/hooks/useShellSession.js
index 4fdfaa32be..ce4d5b8649 100644
--- a/client/src/hooks/useShellSession.js
+++ b/client/src/hooks/useShellSession.js
@@ -237,6 +237,7 @@ export function useShellSession({ isFullscreen } = {}) {
const sendCd = useCallback((path) => emitToSession('shell:cd', { path }), [emitToSession]);
const sendCtrlB = useCallback(() => emitShellInput('\x02'), [emitShellInput]);
const sendCtrlC = useCallback(() => emitShellInput('\x03'), [emitShellInput]);
+ const sendEsc = useCallback(() => emitShellInput('\x1b'), [emitShellInput]);
// Arrow keys send CSI or SS3 based on the terminal's DECCKM state (see NAV_KEYS);
// Enter and any other literal-`seq` keys pass through unchanged. focus:false keeps the
// soft keyboard down on touch — these buttons exist to replace it, not trigger it.
@@ -951,6 +952,7 @@ export function useShellSession({ isFullscreen } = {}) {
sendCd,
sendCtrlB,
sendCtrlC,
+ sendEsc,
sendNavKey,
scrollPage,
restartSession,
diff --git a/client/src/hooks/useShellSession.test.jsx b/client/src/hooks/useShellSession.test.jsx
index eabc985550..6676222b73 100644
--- a/client/src/hooks/useShellSession.test.jsx
+++ b/client/src/hooks/useShellSession.test.jsx
@@ -81,6 +81,14 @@ describe('useShellSession', () => {
expect(lastEmit('shell:input')).toEqual(['shell:input', { sessionId: 'abc', data: '\x02' }]);
});
+ it('sends Escape to the active terminal session', () => {
+ const { result } = renderHook(() => useShellSession({}), { wrapper });
+ fire('shell:sessions', []);
+ fire('shell:started', { sessionId: 'abc' });
+ act(() => result.current.sendEsc());
+ expect(lastEmit('shell:input')).toEqual(['shell:input', { sessionId: 'abc', data: '\x1b' }]);
+ });
+
// cd goes over its own event carrying the PATH — the server owns the quoting,
// because only it knows whether the session runs cmd.exe, PowerShell, or a
// POSIX shell (the hard-coded POSIX form was unusable on Windows).
diff --git a/client/src/pages/Shell.jsx b/client/src/pages/Shell.jsx
index 03b806ed0c..939e450798 100644
--- a/client/src/pages/Shell.jsx
+++ b/client/src/pages/Shell.jsx
@@ -58,6 +58,7 @@ export default function Shell() {
sendCd,
sendCtrlB,
sendCtrlC,
+ sendEsc,
sendNavKey,
scrollPage,
restartSession,
@@ -123,11 +124,11 @@ export default function Shell() {
if (showPasteInput) pasteInputRef.current?.focus();
}, [showPasteInput]);
- // The two toolbars render the same hot-key strip with the same ten props and
+ // The two toolbars render the same hot-key strip with the same eleven props and
// differ only in which way its popover opens; spread one object so a new prop
// reaches both.
const hotKeyProps = {
- sendCtrlB, sendCtrlC, handlePaste, sendNavKey, scrollPage,
+ sendCtrlB, sendCtrlC, sendEsc, handlePaste, sendNavKey, scrollPage,
showPasteInput, setShowPasteInput, pasteInputRef, handlePasteInputEvent, sendImage,
};