diff --git a/apps/app/src/components/views/terminal-view/terminal-panel.tsx b/apps/app/src/components/views/terminal-view/terminal-panel.tsx index eb0f8eb8..c0fb1eab 100644 --- a/apps/app/src/components/views/terminal-view/terminal-panel.tsx +++ b/apps/app/src/components/views/terminal-view/terminal-panel.tsx @@ -59,6 +59,7 @@ export function TerminalPanel({ const wsRef = useRef(null); const reconnectTimeoutRef = useRef(null); const [isTerminalReady, setIsTerminalReady] = useState(false); + const [shellName, setShellName] = useState("shell"); // Get effective theme from store const getEffectiveTheme = useAppStore((state) => state.getEffectiveTheme); @@ -223,6 +224,11 @@ export function TerminalPanel({ break; case "connected": console.log(`[Terminal] Session connected: ${msg.shell} in ${msg.cwd}`); + if (msg.shell) { + // Extract shell name from path (e.g., "/bin/bash" -> "bash") + const name = msg.shell.split("/").pop() || msg.shell; + setShellName(name); + } break; case "exit": terminal.write(`\r\n\x1b[33m[Process exited with code ${msg.exitCode}]\x1b[0m\r\n`); @@ -462,7 +468,7 @@ export function TerminalPanel({
- bash + {shellName} {/* Font size indicator - only show when not default */} {fontSize !== DEFAULT_FONT_SIZE && ( diff --git a/apps/app/src/store/app-store.ts b/apps/app/src/store/app-store.ts index 93deb21f..12547c6a 100644 --- a/apps/app/src/store/app-store.ts +++ b/apps/app/src/store/app-store.ts @@ -1605,7 +1605,8 @@ export const useAppStore = create()( if (current.tabs.length === 0) return; // Find which tab contains this session - const findFirstTerminal = (node: TerminalPanelContent): string | null => { + const findFirstTerminal = (node: TerminalPanelContent | null): string | null => { + if (!node) return null; if (node.type === "terminal") return node.sessionId; for (const panel of node.panels) { const found = findFirstTerminal(panel); @@ -1640,7 +1641,7 @@ export const useAppStore = create()( // Determine new active session const newActiveTabId = newTabs.length > 0 ? (current.activeTabId && newTabs.find(t => t.id === current.activeTabId) ? current.activeTabId : newTabs[0].id) : null; const newActiveSessionId = newActiveTabId - ? findFirstTerminal(newTabs.find(t => t.id === newActiveTabId)?.layout || null as unknown as TerminalPanelContent) + ? findFirstTerminal(newTabs.find(t => t.id === newActiveTabId)?.layout || null) : null; set({