diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 29397f1af..8eefa0244 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -1,5 +1,5 @@ /* eslint-disable max-lines */ -import { useEffect, useMemo } from 'react' +import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' import { DEFAULT_STATUS_BAR_ITEMS, DEFAULT_WORKTREE_CARD_PROPERTIES } from '../../shared/constants' import { isGitRepoKind } from '../../shared/repo-kind' @@ -124,8 +124,11 @@ function App(): React.JSX.Element { const filterRepoIds = useAppStore((s) => s.filterRepoIds) const persistedUIReady = useAppStore((s) => s.persistedUIReady) const rightSidebarWidth = useAppStore((s) => s.rightSidebarWidth) + const rightSidebarOpen = useAppStore((s) => s.rightSidebarOpen) const isFullScreen = useAppStore((s) => s.isFullScreen) const settings = useAppStore((s) => s.settings) + const titlebarLeftControlsRef = useRef(null) + const [collapsedSidebarHeaderWidth, setCollapsedSidebarHeaderWidth] = useState(0) // Subscribe to IPC push events useIpcEvents() @@ -380,6 +383,10 @@ function App(): React.JSX.Element { !hasTabBar && effectiveActiveTabExpanded const showSidebar = activeView !== 'settings' + // Why: when a worktree is active (split groups always enabled), the + // full-width titlebar is replaced by a sidebar-width left header so the + // terminal + tab groups extend to the very top of the window. + const workspaceActive = activeView !== 'settings' && activeWorktreeId !== null const handleToggleExpand = (): void => { if (!effectiveActiveTabId) { @@ -479,196 +486,272 @@ function App(): React.JSX.Element { return () => window.removeEventListener('keydown', onKeyDown, { capture: true }) }, [activeView, activeWorktreeId, actions, repos]) + useLayoutEffect(() => { + const controls = titlebarLeftControlsRef.current + if (!controls) { + return + } + + const updateWidth = (): void => { + setCollapsedSidebarHeaderWidth(controls.getBoundingClientRect().width) + } + + updateWidth() + const observer = new ResizeObserver(() => { + updateWidth() + }) + observer.observe(controls) + return () => observer.disconnect() + }, [ + activeAgentCount, + isFullScreen, + settings?.showTitlebarAgentActivity, + showSidebar, + workspaceActive, + sidebarOpen + ]) + + // Why: extracted so both the full-width titlebar (settings/landing) and + // the sidebar-width left header (workspace view) can share the same + // controls without duplicating the agent badge popover. + const titlebarLeftControls = ( +
+
+ {showSidebar && ( + + + + + + {`Toggle sidebar (${isMac ? '⌘B' : 'Ctrl+B'})`} + + + )} + {settings?.showTitlebarAgentActivity !== false ? ( + + + + + +
0 ? ' titlebar-agent-hovercard-header-with-list' : ''}`} + > + {activeAgentCount === 0 + ? 'No agents active' + : `${activeAgentCount} ${activeAgentCount === 1 ? 'agent' : 'agents'} active`} +
+ {activeAgentCount > 0 && ( +
+ {Object.entries(workingAgentsPerWorktree).map(([worktreeId, { agents }]) => { + const wt = findWorktreeById(worktreesByRepo, worktreeId) + // Why: when a transient git error causes worktreesByRepo to + // lose a worktree, the raw worktreeId (uuid::path) is not + // useful. Extract a cross-platform path basename as a + // readable fallback. + const sepIdx = worktreeId.indexOf('::') + const pathPart = sepIdx !== -1 ? worktreeId.slice(sepIdx + 2) : worktreeId + const fallbackName = pathPart.split(/[\\/]/).pop() || pathPart + return ( +
+ + {agents.map((agent, index) => ( + + ))} +
+ ) + })} +
+ )} + +
+
+ ) : null} +
+ ) + + const rightSidebarToggle = showSidebar ? ( + + + + + + {`Toggle right sidebar (${isMac ? '⌘L' : 'Ctrl+L'})`} + + + ) : null + return ( -
+
-
- {/* Why: the left section of the titlebar matches the sidebar width so - tabs start exactly where the sidebar ends, creating a clean vertical - alignment between the sidebar edge and the first tab. When the - sidebar is collapsed, shrink-0 prevents the flex-1 tab section from - squeezing this area, and mr-2 adds a gap before the first tab. */} -
-
- {/* Why: hide the toggle entirely in settings so no disabled button - or stray Radix PopperAnchor portal appears in the titlebar. */} - {showSidebar && ( + {/* Why: in workspace view (split groups always enabled), the full-width + titlebar is removed so tab groups + terminal extend to the top of + the window. Left titlebar controls move to a header above the sidebar. + Settings and landing views keep the full-width titlebar. */} + {!workspaceActive ? ( +
+
+ {titlebarLeftControls} +
+
+ {showTitlebarExpandButton && ( - {`Toggle sidebar (${isMac ? '⌘B' : 'Ctrl+B'})`} + Collapse pane )} -
Orca
- {settings?.showTitlebarAgentActivity !== false ? ( - - - - - -
0 ? ' titlebar-agent-hovercard-header-with-list' : ''}`} - > - {activeAgentCount === 0 - ? 'No agents active' - : `${activeAgentCount} ${activeAgentCount === 1 ? 'agent' : 'agents'} active`} -
- {activeAgentCount > 0 && ( -
- {Object.entries(workingAgentsPerWorktree).map(([worktreeId, { agents }]) => { - const wt = findWorktreeById(worktreesByRepo, worktreeId) - // Why: when a transient git error causes worktreesByRepo to - // lose a worktree, the raw worktreeId (uuid::path) is not - // useful. Extract a cross-platform path basename as a - // readable fallback. - const sepIdx = worktreeId.indexOf('::') - const pathPart = sepIdx !== -1 ? worktreeId.slice(sepIdx + 2) : worktreeId - const fallbackName = pathPart.split(/[\\/]/).pop() || pathPart - return ( -
- - {agents.map((agent, index) => ( - - ))} -
- ) - })} -
- )} - -
-
- ) : null} + {rightSidebarToggle}
- {/* Why: keep the center titlebar slot mounted even when tabs are hidden. - Using `hidden` here collapsed the spacer entirely, which let the - right-sidebar toggle slide left in the no-tabs empty state. `invisible` - still suppresses any stale portal content without breaking the far-right - titlebar alignment. */} -
- {showTitlebarExpandButton && ( - - - - - - Collapse pane - - - )} - {showSidebar ? ( - - - - - - {`Toggle right sidebar (${isMac ? '⌘L' : 'Ctrl+L'})`} - - - ) : null} -
+ ) : null}
- {showSidebar ? : null} + {showSidebar ? ( + workspaceActive ? ( + /* Why: left column wraps the sidebar with a titlebar-height + header above it. The header holds the same controls + (traffic lights, sidebar toggle, "Orca" title, agent badge) + that the full-width titlebar held while the center and right + columns keep their own top strips at the same 42px height. + When the sidebar is collapsed, take this header out of flex + layout so the terminal/editor reclaim the left edge instead of + leaving behind a content-width blank strip. */ +
+
+ {titlebarLeftControls} +
+ +
+ ) : ( + + ) + ) : null}
+ {/* Why: right sidebar toggle floats at the top-right of the center + column so it's always accessible whether the right sidebar is + open or closed. Its height matches the 42px workspace strip + used by the sidebar and tab rows. */} + {workspaceActive && !rightSidebarOpen && ( +
+ {rightSidebarToggle} +
+ )}
: null}
diff --git a/src/renderer/src/assets/main.css b/src/renderer/src/assets/main.css index b8d9ebec5..b759d4295 100644 --- a/src/renderer/src/assets/main.css +++ b/src/renderer/src/assets/main.css @@ -294,6 +294,24 @@ user-select: none; } +/* Why: workspace view still needs a full titlebar-height strip above the + sidebar so the native macOS traffic lights and sidebar chrome sit in the + same vertical band they use in settings/landing. The center and right + workspace columns are offset separately to align with this 42px baseline. */ +.titlebar-left { + height: 42px; + min-height: 42px; + display: flex; + flex-direction: row; + align-items: center; + overflow: hidden; + flex-shrink: 0; + background: var(--bg-titlebar, var(--card)); + border-bottom: 1px solid var(--border); + -webkit-app-region: drag; + user-select: none; +} + .titlebar-traffic-light-pad { width: calc(80px / var(--ui-zoom-factor, 1)); flex-shrink: 0; @@ -328,21 +346,13 @@ color: var(--muted-foreground); } -.titlebar-title { - font-size: 13px; - font-weight: 500; - color: var(--muted-foreground); - margin-left: 8px; - white-space: nowrap; - flex-shrink: 0; -} - .titlebar-agent-badge { -webkit-app-region: no-drag; display: inline-flex; align-items: center; gap: 6px; - margin-left: 10px; + margin-left: 4px; + margin-right: 8px; padding: 3px 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); diff --git a/src/renderer/src/components/Terminal.tsx b/src/renderer/src/components/Terminal.tsx index fa5c2ff9a..35d20f8b6 100644 --- a/src/renderer/src/components/Terminal.tsx +++ b/src/renderer/src/components/Terminal.tsx @@ -123,18 +123,6 @@ function Terminal(): React.JSX.Element | null { const effectiveActiveLayout = activeWorktreeId ? getEffectiveLayoutForWorktree(activeWorktreeId) : undefined - const activeWorktree = activeWorktreeId - ? (allWorktrees.find((worktree) => worktree.id === activeWorktreeId) ?? null) - : null - const activeTerminalTab = tabs.find((tab) => tab.id === activeTabId) ?? null - const activeEditorFile = worktreeFiles.find((file) => file.id === activeFileId) ?? null - const activeBrowserTab = worktreeBrowserTabs.find((tab) => tab.id === activeBrowserTabId) ?? null - const activeSurfaceLabel = - activeTabType === 'browser' - ? (activeBrowserTab?.title ?? activeBrowserTab?.url ?? 'Browser') - : activeTabType === 'editor' - ? (activeEditorFile?.relativePath ?? activeEditorFile?.filePath ?? 'Editor') - : (activeTerminalTab?.customTitle ?? activeTerminalTab?.title ?? 'Terminal') const activeWorktreeBrowserTabIdsKey = activeWorktreeId ? (browserTabsByWorktree[activeWorktreeId] ?? []).map((tab) => tab.id).join(',') : '' @@ -834,23 +822,9 @@ function Terminal(): React.JSX.Element | null { titlebarTabsTarget )} - {activeWorktreeId && - effectiveActiveLayout && - titlebarTabsTarget && - createPortal( -
- {/* Why: split layouts can show several independent tab rows, so the - titlebar cannot host the real tabs without collapsing multiple - groups into one shared surface. A lightweight summary still uses - that otherwise empty strip and keeps the window chrome balanced. */} - - {activeWorktree?.displayName ?? 'Workspace'} - - / - {activeSurfaceLabel} -
, - titlebarTabsTarget - )} + {/* Why: the full-width titlebar is no longer rendered in workspace view + — tab groups + terminal extend to the top of the window instead. + The old summary label (workspace / active surface) is removed. */} {effectiveActiveLayout ? (
diff --git a/src/renderer/src/components/right-sidebar/index.tsx b/src/renderer/src/components/right-sidebar/index.tsx index f635abeab..9b446bd2c 100644 --- a/src/renderer/src/components/right-sidebar/index.tsx +++ b/src/renderer/src/components/right-sidebar/index.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react' -import { Files, Search, GitBranch, ListChecks } from 'lucide-react' +import { Files, Search, GitBranch, ListChecks, PanelRight } from 'lucide-react' import { useAppStore } from '@/store' import { cn } from '@/lib/utils' import { useSidebarResize } from '@/hooks/useSidebarResize' @@ -114,6 +114,7 @@ function RightSidebarInner(): React.JSX.Element { const setRightSidebarWidth = useAppStore((s) => s.setRightSidebarWidth) const rightSidebarTab = useAppStore((s) => s.rightSidebarTab) const setRightSidebarTab = useAppStore((s) => s.setRightSidebarTab) + const toggleRightSidebar = useAppStore((s) => s.toggleRightSidebar) const checksStatus = useAppStore(getActiveChecksStatus) const activityBarPosition = useAppStore((s) => s.activityBarPosition) const setActivityBarPosition = useAppStore((s) => s.setActivityBarPosition) @@ -173,6 +174,24 @@ function RightSidebarInner(): React.JSX.Element { /> )) + const closeButton = rightSidebarOpen ? ( + + + + + + {`Toggle right sidebar (${isMac ? '⌘L' : 'Ctrl+L'})`} + + + ) : null + return (
-
- {activityBarIcons} +
+ +
{activityBarIcons}
+ {closeButton} +
) : ( /* ── Side layout: static title header ── */ -
+
{visibleItems.find((item) => item.id === effectiveTab)?.title ?? ''} + {closeButton}
)} @@ -276,7 +299,7 @@ function ActivityBarButton({ diff --git a/src/renderer/src/components/tab-group/TabGroupSplitLayout.tsx b/src/renderer/src/components/tab-group/TabGroupSplitLayout.tsx index 9245f9ea1..3bda250d6 100644 --- a/src/renderer/src/components/tab-group/TabGroupSplitLayout.tsx +++ b/src/renderer/src/components/tab-group/TabGroupSplitLayout.tsx @@ -85,7 +85,10 @@ function SplitNode({ worktreeId, focusedGroupId, isWorktreeActive, - hasSplitGroups + hasSplitGroups, + touchesTopEdge, + touchesRightEdge, + touchesLeftEdge }: { node: TabGroupLayoutNode nodePath: string @@ -93,6 +96,9 @@ function SplitNode({ focusedGroupId?: string isWorktreeActive: boolean hasSplitGroups: boolean + touchesTopEdge: boolean + touchesRightEdge: boolean + touchesLeftEdge: boolean }): React.JSX.Element { const setTabGroupSplitRatio = useAppStore((state) => state.setTabGroupSplitRatio) @@ -107,6 +113,8 @@ function SplitNode({ // "focused", Cmd/Ctrl+W and split shortcuts can hit the wrong worktree. isFocused={isWorktreeActive && node.groupId === focusedGroupId} hasSplitGroups={hasSplitGroups} + reserveClosedExplorerToggleSpace={touchesTopEdge && touchesRightEdge} + reserveCollapsedSidebarHeaderSpace={touchesTopEdge && touchesLeftEdge} /> ) } @@ -127,6 +135,9 @@ function SplitNode({ focusedGroupId={focusedGroupId} isWorktreeActive={isWorktreeActive} hasSplitGroups={hasSplitGroups} + touchesTopEdge={touchesTopEdge} + touchesRightEdge={isHorizontal ? false : touchesRightEdge} + touchesLeftEdge={touchesLeftEdge} />
@@ -167,6 +181,9 @@ export default function TabGroupSplitLayout({ focusedGroupId={focusedGroupId} isWorktreeActive={isWorktreeActive} hasSplitGroups={layout.type === 'split'} + touchesTopEdge={true} + touchesRightEdge={true} + touchesLeftEdge={true} />
)