diff --git a/apps/ui/src/components/views/settings-view/terminal/terminal-section.tsx b/apps/ui/src/components/views/settings-view/terminal/terminal-section.tsx index 67e4cad1..e7092000 100644 --- a/apps/ui/src/components/views/settings-view/terminal/terminal-section.tsx +++ b/apps/ui/src/components/views/settings-view/terminal/terminal-section.tsx @@ -181,7 +181,7 @@ export function TerminalSection() { - New Tab (named after branch) + New Tab Split Current Tab diff --git a/apps/ui/src/components/views/terminal-view.tsx b/apps/ui/src/components/views/terminal-view.tsx index 0f7d65b0..88075747 100644 --- a/apps/ui/src/components/views/terminal-view.tsx +++ b/apps/ui/src/components/views/terminal-view.tsx @@ -596,22 +596,27 @@ export function TerminalView() { pendingTerminalCreatedRef.current = true; if (openMode === 'newTab') { - // Create a new tab named after the branch - const newTabId = addTerminalTab(pending.branchName); + // Create a new tab with default naming + const newTabId = addTerminalTab(); - // Set the tab's layout to the new terminal + // Set the tab's layout to the new terminal with branch name for display in header useAppStore .getState() .setTerminalTabLayout( newTabId, - { type: 'terminal', sessionId: data.data.id, size: 100 }, + { + type: 'terminal', + sessionId: data.data.id, + size: 100, + branchName: pending.branchName, + }, data.data.id ); toast.success(`Opened terminal for ${pending.branchName}`); } else { - // Split mode: add to current tab layout - addTerminalToLayout(data.data.id); - toast.success(`Opened terminal in ${pending.cwd.split('/').pop() || pending.cwd}`); + // Split mode: add to current tab layout with branch name + addTerminalToLayout(data.data.id, 'horizontal', undefined, pending.branchName); + toast.success(`Opened terminal for ${pending.branchName}`); } // Mark this session as new for running initial command @@ -789,6 +794,7 @@ export function TerminalView() { sessionId, size: persisted.size, fontSize: persisted.fontSize, + branchName: persisted.branchName, }; } @@ -1347,6 +1353,7 @@ export function TerminalView() { onCommandRan={() => handleCommandRan(content.sessionId)} isMaximized={terminalState.maximizedSessionId === content.sessionId} onToggleMaximize={() => toggleTerminalMaximized(content.sessionId)} + branchName={content.branchName} /> ); diff --git a/apps/ui/src/components/views/terminal-view/terminal-panel.tsx b/apps/ui/src/components/views/terminal-view/terminal-panel.tsx index 88f02591..ce6359c8 100644 --- a/apps/ui/src/components/views/terminal-view/terminal-panel.tsx +++ b/apps/ui/src/components/views/terminal-view/terminal-panel.tsx @@ -21,6 +21,7 @@ import { Maximize2, Minimize2, ArrowDown, + GitBranch, } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Spinner } from '@/components/ui/spinner'; @@ -94,6 +95,7 @@ interface TerminalPanelProps { onCommandRan?: () => void; // Callback when the initial command has been sent isMaximized?: boolean; onToggleMaximize?: () => void; + branchName?: string; // Branch name to display in header (from "Open in Terminal" action) } // Type for xterm Terminal - we'll use any since we're dynamically importing @@ -124,6 +126,7 @@ export function TerminalPanel({ onCommandRan, isMaximized = false, onToggleMaximize, + branchName, }: TerminalPanelProps) { const terminalRef = useRef(null); const containerRef = useRef(null); @@ -1776,6 +1779,13 @@ export function TerminalPanel({
{shellName} + {/* Branch name indicator - show when terminal was opened from worktree */} + {branchName && ( + + + {branchName} + + )} {/* Font size indicator - only show when not default */} {fontSize !== DEFAULT_FONT_SIZE && (