Skip to content

The agent that grows with you

fix(desktop): keep plugin titlebar slots on extension pages

KoNit-K564895fea816
diff --git a/apps/desktop/src/app/routes.ts b/apps/desktop/src/app/routes.ts
index 8c54a6ac357..7940f6e62f6 100644
--- a/apps/desktop/src/app/routes.ts
+++ b/apps/desktop/src/app/routes.ts
@@ -141,11 +141,11 @@ export function isOverlayView(view: AppView): boolean {
return OVERLAY_VIEWS.has(view)
}
-/** True when TitlebarControls must unmount the app's fixed tool clusters.
- * Overlays already own the window; contributed full pages (`extension`)
- * bring their own titlebar chrome (`titleBar.center` etc.) and the clusters
- * would otherwise sit on top of it. First-party workspace pages
- * (skills/messaging/artifacts) keep the clusters. */
+/** True when TitlebarControls must hide the app's fixed tool clusters.
+ * Overlays already own the window (clusters AND titleBar slots unmount).
+ * Contributed full pages (`extension`) hide the app clusters but keep the
+ * titleBar slots so plugin chrome can own that space. First-party workspace
+ * pages (skills/messaging/artifacts) keep the clusters. */
export function hidesFixedTitlebarClusters(view: AppView): boolean {
return isOverlayView(view) || view === 'extension'
}
diff --git a/apps/desktop/src/app/shell/titlebar-controls.test.tsx b/apps/desktop/src/app/shell/titlebar-controls.test.tsx
index 56f3a53c118..769a95d3177 100644
--- a/apps/desktop/src/app/shell/titlebar-controls.test.tsx
+++ b/apps/desktop/src/app/shell/titlebar-controls.test.tsx
@@ -22,21 +22,29 @@ function renderControls(pathname: string) {
const windowControls = () => screen.queryByLabelText('Window controls')
const appControls = () => screen.queryByLabelText('App controls')
+const pluginChrome = () => screen.queryByText('plugin-chrome')
describe('TitlebarControls fixed clusters', () => {
- let disposeRoute: () => void
+ let dispose: () => void
beforeEach(() => {
- disposeRoute = registry.register({
- area: ROUTES_AREA,
- data: { path: '/kanban' },
- id: 'test-kanban-route',
- render: () => null
- })
+ dispose = registry.registerMany([
+ {
+ area: ROUTES_AREA,
+ data: { path: '/kanban' },
+ id: 'test-kanban-route',
+ render: () => null
+ },
+ {
+ area: 'titleBar.center',
+ id: 'test-plugin-chrome',
+ render: () => <span>plugin-chrome</span>
+ }
+ ])
})
afterEach(() => {
- disposeRoute()
+ dispose()
cleanup()
})
@@ -47,6 +55,14 @@ describe('TitlebarControls fixed clusters', () => {
expect(appControls()).toBeNull()
})
+ it('keeps plugin titlebar contributions on a contributed full-page route', () => {
+ renderControls('/kanban')
+
+ expect(pluginChrome()).not.toBeNull()
+ expect(windowControls()).toBeNull()
+ expect(appControls()).toBeNull()
+ })
+
it('keeps the app clusters on chat', () => {
renderControls('/')
@@ -61,6 +77,12 @@ describe('TitlebarControls fixed clusters', () => {
expect(appControls()).toBeNull()
})
+ it('hides plugin titlebar contributions on an overlay', () => {
+ renderControls('/settings')
+
+ expect(pluginChrome()).toBeNull()
+ })
+
it('keeps the app clusters on a first-party workspace page', () => {
renderControls('/skills')
diff --git a/apps/desktop/src/app/shell/titlebar-controls.tsx b/apps/desktop/src/app/shell/titlebar-controls.tsx
index c3a2f507bfe..5f5fd1718f0 100644
--- a/apps/desktop/src/app/shell/titlebar-controls.tsx
+++ b/apps/desktop/src/app/shell/titlebar-controls.tsx
@@ -25,7 +25,7 @@ import {
} from '@/store/layout'
import { $unreadSessionCount } from '@/store/session-dot-state'
-import { appViewForPath, hidesFixedTitlebarClusters } from '../routes'
+import { appViewForPath, hidesFixedTitlebarClusters, isOverlayView } from '../routes'
import {
TITLEBAR_ICON_BADGE_SCALE,
@@ -235,32 +235,43 @@ export function TitlebarControls({ leftTools = [], tools = [], onOpenSettings }:
}
]
- // While a full-screen overlay (settings, command center, …) or a contributed
- // full-context plugin page (`extension`, e.g. /kanban) is open it should
- // visually own the window. These control clusters are `fixed` at a higher
- // z-index than the overlay card / plugin titlebar chrome, so they'd otherwise
- // bleed over it — hide them and let that surface's own chrome take over.
- if (hidesFixedTitlebarClusters(appViewForPath(location.pathname))) {
+ const view = appViewForPath(location.pathname)
+
+ // Overlays own the window. These clusters are `fixed` at a higher z-index
+ // than the overlay card, so they'd otherwise bleed over it — hide them (and
+ // the nested titleBar slots) and let the overlay's own chrome take over.
+ if (isOverlayView(view)) {
return null
}
+ const titlebarSlots = (
+ <>
+ <Slot area="titleBar.left" />
+ <Slot area="titleBar.center" />
+ <Slot area="titleBar.right" />
+ </>
+ )
+ const leftClusterClass = cn(
+ titlebarToolClusterClass,
+ 'left-(--titlebar-controls-left) top-(--titlebar-controls-top) translate-y-(--titlebar-controls-y-nudge)'
+ )
+
+ // Contributed full-context plugin pages (`extension`) own the titlebar band.
+ // Hide the app's tool clusters but keep plugin slots in the same fixed
+ // position so `titleBar.center` (e.g. kanban's board switcher) stays mounted.
+ if (hidesFixedTitlebarClusters(view)) {
+ return <div className={leftClusterClass}>{titlebarSlots}</div>
+ }
+
const visibleLeftTools = [sidebarTool, ...systemTools, ...leftTools, ...tools].filter(tool => !tool.hidden)
return (
<>
- <div
- aria-label={t.shell.windowControls}
- className={cn(
- titlebarToolClusterClass,
- 'left-(--titlebar-controls-left) top-(--titlebar-controls-top) translate-y-(--titlebar-controls-y-nudge)'
- )}
- >
+ <div aria-label={t.shell.windowControls} className={leftClusterClass}>
{visibleLeftTools.map(tool => (
<TitlebarToolButton key={tool.id} navigate={navigate} tool={tool} />
))}
- <Slot area="titleBar.left" />
- <Slot area="titleBar.center" />
- <Slot area="titleBar.right" />
+ {titlebarSlots}
</div>
<div