Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat: add custom desktop window controls

Josué0c965c9f2a65
diff --git a/desktop-app/src/main.ts b/desktop-app/src/main.ts
index bad38941c..fc6034a08 100644
--- a/desktop-app/src/main.ts
+++ b/desktop-app/src/main.ts
@@ -93,6 +93,17 @@ function windowState(win: BrowserWindow | null): { visible: boolean; focused: bo
return { visible: isWindowVisible(win), focused: isAppFocused() }
}
+type WindowControlsState = { maximized: boolean; fullscreen: boolean }
+
+function windowControlsState(win: BrowserWindow | null): WindowControlsState {
+ return { maximized: Boolean(win?.isMaximized()), fullscreen: Boolean(win?.isFullScreen()) }
+}
+
+function emitWindowControlsState(win: BrowserWindow): void {
+ if (win.isDestroyed()) return
+ win.webContents.send('window:controlsState', windowControlsState(win))
+}
+
/**
* GAP-D1 (spec-v2 §4.5-4): after the OS sleeps/resumes (or the screen locks and
* unlocks), open SSE sockets are typically dead but neither the tracker watchdog
@@ -124,6 +135,15 @@ function wireWindowVisibility(win: BrowserWindow): void {
win.on('restore', emit)
}
+function wireWindowControls(win: BrowserWindow): void {
+ const emit = () => emitWindowControlsState(win)
+ win.on('maximize', emit)
+ win.on('unmaximize', emit)
+ win.on('enter-full-screen', emit)
+ win.on('leave-full-screen', emit)
+ win.on('restore', emit)
+}
+
/**
* App-level focus events are process-scoped. Register them once so closing and
* recreating the main window cannot accumulate listeners that retain a
@@ -147,10 +167,39 @@ ipcMain.handle('window:getVisibility', event => {
return windowState(mainWindow)
})
+ipcMain.handle('window:getControlsState', event => {
+ assertTrustedSender(event)
+ return windowControlsState(mainWindow)
+})
+
+ipcMain.handle('window:minimize', event => {
+ assertTrustedSender(event)
+ mainWindow?.minimize()
+})
+
+ipcMain.handle('window:toggleMaximize', event => {
+ assertTrustedSender(event)
+ if (!mainWindow || mainWindow.isDestroyed()) return
+ if (mainWindow.isFullScreen()) {
+ mainWindow.setFullScreen(false)
+ } else if (mainWindow.isMaximized()) {
+ mainWindow.unmaximize()
+ } else {
+ mainWindow.maximize()
+ }
+ emitWindowControlsState(mainWindow)
+})
+
+ipcMain.handle('window:close', event => {
+ assertTrustedSender(event)
+ mainWindow?.close()
+})
+
ipcMain.handle('app:rendererReady', event => {
assertTrustedSender(event)
if (!mainWindow || event.sender !== mainWindow.webContents) return
mainWindowRendererReady = true
+ emitWindowControlsState(mainWindow)
evenfireDeepLinkRouter.drainPending()
// U5: flush mcp-oauth completions that arrived before the renderer installed
// its listener (cold start). The onMcpOauthCompleted listener is registered by
@@ -317,6 +366,7 @@ async function createWindow(): Promise<void> {
width: 1240,
height: 860,
show: false,
+ frame: false,
title:
config.appName === EVENFIRE_APP_NAME
? EVENFIRE_APP_NAME
@@ -347,6 +397,7 @@ async function createWindow(): Promise<void> {
})
wireWindowVisibility(window)
+ wireWindowControls(window)
wireAppWindowVisibility()
window.webContents.setWindowOpenHandler(() => ({ action: 'deny' }))
diff --git a/desktop-app/src/preload.ts b/desktop-app/src/preload.ts
index cd5e5f697..a5d655690 100644
--- a/desktop-app/src/preload.ts
+++ b/desktop-app/src/preload.ts
@@ -516,6 +516,10 @@ const clerum = Object.freeze({
},
window: {
getVisibility: () => ipcRenderer.invoke('window:getVisibility'),
+ getControlsState: () => ipcRenderer.invoke('window:getControlsState'),
+ minimize: () => ipcRenderer.invoke('window:minimize'),
+ toggleMaximize: () => ipcRenderer.invoke('window:toggleMaximize'),
+ close: () => ipcRenderer.invoke('window:close'),
onVisibilityChange: (callback: (state: { visible: boolean; focused: boolean }) => void) => {
const listener = (
_event: Electron.IpcRendererEvent,
@@ -524,6 +528,16 @@ const clerum = Object.freeze({
ipcRenderer.on('window:visibility', listener)
return () => ipcRenderer.off('window:visibility', listener)
},
+ onControlsStateChange: (
+ callback: (state: { fullscreen: boolean; maximized: boolean }) => void
+ ) => {
+ const listener = (
+ _event: Electron.IpcRendererEvent,
+ state: { fullscreen: boolean; maximized: boolean }
+ ) => callback(state)
+ ipcRenderer.on('window:controlsState', listener)
+ return () => ipcRenderer.off('window:controlsState', listener)
+ },
},
system: {
// GAP-D1 (§4.5-4): fired after OS sleep/resume or screen unlock so the renderer
diff --git a/desktop-app/src/renderer.d.ts b/desktop-app/src/renderer.d.ts
index a956126ba..d4a08f75b 100644
--- a/desktop-app/src/renderer.d.ts
+++ b/desktop-app/src/renderer.d.ts
@@ -604,9 +604,16 @@ declare global {
}
window: {
getVisibility: () => Promise<{ visible: boolean; focused: boolean }>
+ getControlsState: () => Promise<{ fullscreen: boolean; maximized: boolean }>
+ minimize: () => Promise<void>
+ toggleMaximize: () => Promise<void>
+ close: () => Promise<void>
onVisibilityChange: (
callback: (state: { visible: boolean; focused: boolean }) => void
) => () => void
+ onControlsStateChange: (
+ callback: (state: { fullscreen: boolean; maximized: boolean }) => void
+ ) => () => void
}
system: {
/** GAP-D1 (§4.5-4): OS resume / screen unlock tick — reconcile in-flight chats. */
diff --git a/desktop-app/ui/src/App.tsx b/desktop-app/ui/src/App.tsx
index 36dfc9107..928478782 100644
--- a/desktop-app/ui/src/App.tsx
+++ b/desktop-app/ui/src/App.tsx
@@ -22,6 +22,7 @@ import { GfsImagePreview } from '@components/GfsImagePreview'
import { PluginConsentModal } from '@components/PluginConsentModal'
import type { PluginConsentRequest } from '@components/PluginConsentModal/types'
import { SidebarNav } from '@components/SidebarNav'
+import { WindowTitleBar } from '@components/WindowTitleBar'
import { DESKTOP_ROUTES, SIDEBAR_COLLAPSED_KEY } from '@constants/navigation'
import { THEME_STORAGE_KEY } from '@constants/theme'
import { useAgentChatActionsValue } from '@hooks/useAgentChatActionsValue'
@@ -2031,243 +2032,250 @@ export function App() {
return (
<AuthContext.Provider value={authValue}>
- <div className="app-root" inert={bootSplashLoading || undefined}>
- {vm.isAuthenticated ? (
- <NavigationContext.Provider value={navValue}>
- <NotificationsContext.Provider value={notifValue}>
- <WorkspaceActionsProvider value={workspaceActionsValue}>
- <AgentActivityProvider value={agentActivityValue}>
- <AgentChatProviders
- actions={agentChatActionsValue}
- chatList={chatListValue}
- composerState={chatComposerStateValue}
- threadState={chatThreadStateValue}
- >
- <McpRuntimeProvider value={mcpRuntimeValue}>
- <DesktopStateProvider value={desktopStateValue}>
- <main className="app-shell">
- <SidebarNav
- navItem={
- vm.navItem === DESKTOP_ROUTES.teamDetails
- ? DESKTOP_ROUTES.teams
- : vm.navItem === DESKTOP_ROUTES.contextDetails
- ? DESKTOP_ROUTES.contexts
- : vm.navItem
- }
- activeSandboxUiApp={activeSandboxUiApp}
- availableSandboxUiApps={availableSandboxUiApps}
- collapsed={sidebarCollapsed}
- onCollapsedChange={handleSidebarCollapsedChange}
- onNewChat={handleNewChatViewTab}
- onOpenSandboxUiApp={handleOpenSandboxUiApp}
- onSettingsMenuOpenChange={setSidebarSettingsMenuOpen}
- onSelect={handleSidebarNavSelect}
- toggleRequestId={sidebarToggleRequestId}
- />
- <section className="workspace-layout">
- <section
- ref={contentPanelRef}
- className={`content-panel glass-card${
- isAgentChatView ? ' content-panel--agent-chat' : ''
- }${vm.navItem === DESKTOP_ROUTES.settings ? ' content-panel--settings' : ''}${
- appNotificationDrawerOpen
- ? ' content-panel--app-notification-drawer-open'
- : ''
- }${chatDrawerVisible ? ' content-panel--chat-drawer-open' : ''}`}
- style={
- chatDrawerVisible
- ? {
- '--chat-drawer-width': `${chatDrawerResize.width}px`,
- // Only publish the measured top once we have one;
- // when unmeasured (null, pre-measure/tests) the CSS
- // fallback applies. Uses null — not 0 — so a legitimate
- // rect.top of 0/negative still follows the embed.
- ...(chatDrawerEmbedTop !== null
- ? { '--chat-drawer-top': `${chatDrawerEmbedTop}px` }
- : {}),
- }
- : undefined
+ <div className="app-frame">
+ <WindowTitleBar />
+ <div className="app-root" inert={bootSplashLoading || undefined}>
+ {vm.isAuthenticated ? (
+ <NavigationContext.Provider value={navValue}>
+ <NotificationsContext.Provider value={notifValue}>
+ <WorkspaceActionsProvider value={workspaceActionsValue}>
+ <AgentActivityProvider value={agentActivityValue}>
+ <AgentChatProviders
+ actions={agentChatActionsValue}
+ chatList={chatListValue}
+ composerState={chatComposerStateValue}
+ threadState={chatThreadStateValue}
+ >
+ <McpRuntimeProvider value={mcpRuntimeValue}>
+ <DesktopStateProvider value={desktopStateValue}>
+ <main className="app-shell">
+ <SidebarNav
+ navItem={
+ vm.navItem === DESKTOP_ROUTES.teamDetails
+ ? DESKTOP_ROUTES.teams
+ : vm.navItem === DESKTOP_ROUTES.contextDetails
+ ? DESKTOP_ROUTES.contexts
+ : vm.navItem
}
- >
- <AppHeader
- searchFocusRequestId={globalSearchFocusRequestId}
- notificationOpenRequestId={notificationOpenRequestId}
- notificationTrayMode={
- notificationTrayUsesDrawer ? 'drawer' : 'overlay'
+ activeSandboxUiApp={activeSandboxUiApp}
+ availableSandboxUiApps={availableSandboxUiApps}
+ collapsed={sidebarCollapsed}
+ onCollapsedChange={handleSidebarCollapsedChange}
+ onNewChat={handleNewChatViewTab}
+ onOpenSandboxUiApp={handleOpenSandboxUiApp}
+ onSettingsMenuOpenChange={setSidebarSettingsMenuOpen}
+ onSelect={handleSidebarNavSelect}
+ toggleRequestId={sidebarToggleRequestId}
+ />
+ <section className="workspace-layout">
+ <section
+ ref={contentPanelRef}
+ className={`content-panel glass-card${
+ isAgentChatView ? ' content-panel--agent-chat' : ''
+ }${vm.navItem === DESKTOP_ROUTES.settings ? ' content-panel--settings' : ''}${
+ appNotificationDrawerOpen
+ ? ' content-panel--app-notification-drawer-open'
+ : ''
+ }${chatDrawerVisible ? ' content-panel--chat-drawer-open' : ''}`}
+ style={
+ chatDrawerVisible
+ ? {
+ '--chat-drawer-width': `${chatDrawerResize.width}px`,
+ // Only publish the measured top once we have one;
+ // when unmeasured (null, pre-measure/tests) the CSS
+ // fallback applies. Uses null — not 0 — so a legitimate
+ // rect.top of 0/negative still follows the embed.
+ ...(chatDrawerEmbedTop !== null
+ ? { '--chat-drawer-top': `${chatDrawerEmbedTop}px` }
+ : {}),
+ }
+ : undefined
}
- notificationTrayReady={notificationDrawerReady}
- onNotificationTrayOpenChange={setHeaderNotificationTrayOpen}
- onShellOverlayOpenChange={setHeaderShellOverlayOpen}
- />
- <ToastStack items={vm.toasts} />
- {vm.navItem === DESKTOP_ROUTES.chat && (
- <ChatViewWorkspace
- activeTabId={chatViewTabs.activeTabId}
- localSearch={
- chatLocalSearchOpen ? (
- <ChatLocalSearch
- models={chatSemanticModels}
- onClose={closeChatLocalSearch}
- onSearchStateChange={handleChatLocalSearchStateChange}
- />
- ) : null
+ >
+ <AppHeader
+ searchFocusRequestId={globalSearchFocusRequestId}
+ notificationOpenRequestId={notificationOpenRequestId}
+ notificationTrayMode={
+ notificationTrayUsesDrawer ? 'drawer' : 'overlay'
}
- onClose={handleCloseChatViewTab}
- onSelect={handleSelectChatViewTab}
- surfaceId="chat-view-panel"
- tabs={chatViewTabs.tabs}
- >
- <ChatPage scrollContainerRef={contentPanelRef} />
- </ChatViewWorkspace>
- )}
- {vm.navItem === DESKTOP_ROUTES.agents && (
- <AgentsPage scrollContainerRef={contentPanelRef} />
- )}
- {vm.navItem === DESKTOP_ROUTES.contexts && <ContextsPage />}
- {vm.navItem === DESKTOP_ROUTES.files && (
- <FilesPage
- pushToast={vm.pushToast}
- pendingGfsUri={pendingGfsUri}
- onPendingGfsUriHandled={() => setPendingGfsUri(null)}
+ notificationTrayReady={notificationDrawerReady}
+ onNotificationTrayOpenChange={setHeaderNotificationTrayOpen}
+ onShellOverlayOpenChange={setHeaderShellOverlayOpen}
/>
- )}
- {vm.navItem === DESKTOP_ROUTES.connectors && <McpServersPage />}
- {vm.navItem === DESKTOP_ROUTES.contextDetails && (
- <ContextDetailsPage />
- )}
- {vm.navItem === DESKTOP_ROUTES.plugins && <WorkflowsPage />}
- {vm.navItem === DESKTOP_ROUTES.apps && (
- <>
- <SandboxUiPage
- boundsRefreshKey={sandboxUiBoundsRefreshKey}
- actionRequest={sandboxActionRequest}
- conversationOrigin={sandboxUiConversationOrigin}
- currentTeamId={vm.currentTeamId}
- headerShellOverlayOpen={
- headerShellOverlayOpen || commandPaletteOpen
+ <ToastStack items={vm.toasts} />
+ {vm.navItem === DESKTOP_ROUTES.chat && (
+ <ChatViewWorkspace
+ activeTabId={chatViewTabs.activeTabId}
+ localSearch={
+ chatLocalSearchOpen ? (
+ <ChatLocalSearch
+ models={chatSemanticModels}
+ onClose={closeChatLocalSearch}
+ onSearchStateChange={handleChatLocalSearchStateChange}
+ />
+ ) : null
}
- sidebarShellOverlayOpen={sidebarSettingsMenuOpen}
- toastShellOverlayOpen={vm.toasts.length > 0}
- deepLinkShellOverlayOpen={sandboxUiDeepLinkDialog !== null}
- shortcutApp={activeSandboxUiApp}
- shortcutOpenRequestId={sandboxUiShortcutOpenRequestId}
- localSearchRequestId={sandboxLocalSearchRequestId}
- chatDrawerOpen={chatDrawerVisible}
- onToggleChatDrawer={toggleChatDrawer}
- onBackToConversation={handleSandboxUiBackToConversation}
- onEmbeddedAppOpening={handleSandboxUiOpening}
- onEmbeddedAppMounted={handleSandboxUiMounted}
- onEmbeddedAppBack={handleSandboxUiClosed}
- onEmbeddedAppRemoved={handleSandboxUiRemoved}
- onEmbedBoundsApplied={handleSandboxUiBoundsApplied}
- onEmbedSlotTopChange={setChatDrawerEmbedTop}
- onNotify={vm.pushToast}
- onShortcutOpenResult={handleSandboxUiShortcutOpenResult}
+ onClose={handleCloseChatViewTab}
+ onSelect={handleSelectChatViewTab}
+ surfaceId="chat-view-panel"
+ tabs={chatViewTabs.tabs}
+ >
+ <ChatPage scrollContainerRef={contentPanelRef} />
+ </ChatViewWorkspace>
+ )}
+ {vm.navItem === DESKTOP_ROUTES.agents && (
+ <AgentsPage scrollContainerRef={contentPanelRef} />
+ )}
+ {vm.navItem === DESKTOP_ROUTES.contexts && <ContextsPage />}
+ {vm.navItem === DESKTOP_ROUTES.files && (
+ <FilesPage
+ pushToast={vm.pushToast}
+ pendingGfsUri={pendingGfsUri}
+ onPendingGfsUriHandled={() => setPendingGfsUri(null)}
/>
- {chatDrawerVisible && (
- <ChatDrawer
- header={
- <ChatSwitcher
- tabs={chatViewTabs.tabs}
- activeTabId={chatViewTabs.activeTabId}
- onSelect={handleSelectChatViewTab}
- onNewChat={handleNewChatViewTab}
- focusRequestId={chatSwitcherFocusRequestId}
- />
+ )}
+ {vm.navItem === DESKTOP_ROUTES.connectors && <McpServersPage />}
+ {vm.navItem === DESKTOP_ROUTES.contextDetails && (
+ <ContextDetailsPage />
+ )}
+ {vm.navItem === DESKTOP_ROUTES.plugins && <WorkflowsPage />}
+ {vm.navItem === DESKTOP_ROUTES.apps && (
+ <>
+ <SandboxUiPage
+ boundsRefreshKey={sandboxUiBoundsRefreshKey}
+ actionRequest={sandboxActionRequest}
+ conversationOrigin={sandboxUiConversationOrigin}
+ currentTeamId={vm.currentTeamId}
+ headerShellOverlayOpen={
+ headerShellOverlayOpen || commandPaletteOpen
}
- onNewChat={handleNewChatViewTab}
- onClose={closeChatDrawer}
- containerRef={chatDrawerRef}
- ready={chatDrawerReady}
- onResizeHandleMouseDown={
- chatDrawerResize.onResizeHandleMouseDown
- }
- onResizeHandleKeyDown={chatDrawerResize.onResizeHandleKeyDown}
- width={chatDrawerResize.width}
- resizing={chatDrawerResize.isResizing}
- >
- <ChatPage scrollContainerRef={chatDrawerRef} />
- </ChatDrawer>
- )}
- </>
- )}
- {vm.navItem === DESKTOP_ROUTES.settings && (
- <SettingsPage
- shortcutsFocusRequestId={settingsShortcutsRequestId}
- notificationSettings={vm.notificationSettings}
- desktopNotificationPermission={vm.desktopNotificationPermission}
- themeMode={themeMode}
- onNotify={vm.pushToast}
- onThemeModeChange={setThemeMode}
- onNotificationSoundVolumeChange={vm.setNotificationSoundVolume}
- onPlayNotificationSoundPreview={vm.playNotificationSoundPreview}
- onSaveNotificationSettings={vm.saveNotificationSettings}
- channelNotificationPreferences={vm.channelNotificationPreferences}
- channelNotificationPreferencesLoading={
- vm.channelNotificationPreferencesLoading
- }
- channelNotificationPreferencesSaving={
- vm.channelNotificationPreferencesSaving
- }
- onSaveChannelNotificationPreferences={
- vm.saveChannelNotificationPreferences
- }
- />
- )}
- {vm.navItem === DESKTOP_ROUTES.teams && <TeamsPage />}
- {vm.navItem === DESKTOP_ROUTES.teamDetails && <TeamDetailsPage />}
+ sidebarShellOverlayOpen={sidebarSettingsMenuOpen}
+ toastShellOverlayOpen={vm.toasts.length > 0}
+ deepLinkShellOverlayOpen={sandboxUiDeepLinkDialog !== null}
+ shortcutApp={activeSandboxUiApp}
+ shortcutOpenRequestId={sandboxUiShortcutOpenRequestId}
+ localSearchRequestId={sandboxLocalSearchRequestId}
+ chatDrawerOpen={chatDrawerVisible}
+ onToggleChatDrawer={toggleChatDrawer}
+ onBackToConversation={handleSandboxUiBackToConversation}
+ onEmbeddedAppOpening={handleSandboxUiOpening}
+ onEmbeddedAppMounted={handleSandboxUiMounted}
+ onEmbeddedAppBack={handleSandboxUiClosed}
+ onEmbeddedAppRemoved={handleSandboxUiRemoved}
+ onEmbedBoundsApplied={handleSandboxUiBoundsApplied}
+ onEmbedSlotTopChange={setChatDrawerEmbedTop}
+ onNotify={vm.pushToast}
+ onShortcutOpenResult={handleSandboxUiShortcutOpenResult}
+ />
+ {chatDrawerVisible && (
+ <ChatDrawer
+ header={
+ <ChatSwitcher
+ tabs={chatViewTabs.tabs}
+ activeTabId={chatViewTabs.activeTabId}
+ onSelect={handleSelectChatViewTab}
+ onNewChat={handleNewChatViewTab}
+ focusRequestId={chatSwitcherFocusRequestId}
+ />
+ }
+ onNewChat={handleNewChatViewTab}
+ onClose={closeChatDrawer}
+ containerRef={chatDrawerRef}
+ ready={chatDrawerReady}
+ onResizeHandleMouseDown={
+ chatDrawerResize.onResizeHandleMouseDown
+ }
+ onResizeHandleKeyDown={
+ chatDrawerResize.onResizeHandleKeyDown
+ }
+ width={chatDrawerResize.width}
+ resizing={chatDrawerResize.isResizing}
+ >
+ <ChatPage scrollContainerRef={chatDrawerRef} />
+ </ChatDrawer>
+ )}
+ </>
+ )}
+ {vm.navItem === DESKTOP_ROUTES.settings && (
+ <SettingsPage
+ shortcutsFocusRequestId={settingsShortcutsRequestId}
+ notificationSettings={vm.notificationSettings}
+ desktopNotificationPermission={vm.desktopNotificationPermission}
+ themeMode={themeMode}
+ onNotify={vm.pushToast}
+ onThemeModeChange={setThemeMode}
+ onNotificationSoundVolumeChange={vm.setNotificationSoundVolume}
+ onPlayNotificationSoundPreview={vm.playNotificationSoundPreview}
+ onSaveNotificationSettings={vm.saveNotificationSettings}
+ channelNotificationPreferences={
+ vm.channelNotificationPreferences
+ }
+ channelNotificationPreferencesLoading={
+ vm.channelNotificationPreferencesLoading
+ }
+ channelNotificationPreferencesSaving={
+ vm.channelNotificationPreferencesSaving
+ }
+ onSaveChannelNotificationPreferences={
+ vm.saveChannelNotificationPreferences
+ }
+ />
+ )}
+ {vm.navItem === DESKTOP_ROUTES.teams && <TeamsPage />}
+ {vm.navItem === DESKTOP_ROUTES.teamDetails && <TeamDetailsPage />}
+ </section>
</section>
- </section>
- </main>
- {commandPaletteOpen ? (
- <CommandPalette
- platform={platformFromNavigator(navigator.platform)}
- isEligible={isCommandEligible}
- onClose={closeCommandPalette}
- onExecute={commandId => executeDesktopCommand(commandId, 'palette')}
- restorePreviousFocus={!commandPaletteReturnToSandbox}
- />
- ) : null}
- {desktopUpdateRequiredDialog}
- {environmentSetupConfirmationDialog}
- {environmentSetupSuccessDialog}
- {sandboxUiDeepLinkDialog}
- {pluginConsentPrompt ? (
- <PluginConsentModal
- request={pluginConsentPrompt}
- onResolve={resolvePluginConsent}
- />
- ) : null}
- {pluginGfsPreview ? (
- <GfsImagePreview
- byteLength={pluginGfsPreview.bytes}
- fileName={pluginGfsPreview.name}
- gfsUri={pluginGfsPreview.gfsUri}
- mimeType={pluginGfsPreview.mimeType}
- onClose={closePluginGfsPreview}
- />
- ) : null}
- </DesktopStateProvider>
- </McpRuntimeProvider>
- </AgentChatProviders>
- </AgentActivityProvider>
- </WorkspaceActionsProvider>
- </NotificationsContext.Provider>
- </NavigationContext.Provider>
- ) : (
- <>
- {vm.unauthenticatedView === 'outage' ? (
- <UnavailablePage />
- ) : vm.unauthenticatedView === 'onboarding' ? (
- <OnboardingPage onboarding={vm.onboarding} />
- ) : (
- <AuthPage />
- )}
- {environmentSetupConfirmationDialog}
- {environmentSetupSuccessDialog}
- <ToastStack items={vm.toasts} />
- </>
- )}
+ </main>
+ {commandPaletteOpen ? (
+ <CommandPalette
+ platform={platformFromNavigator(navigator.platform)}
+ isEligible={isCommandEligible}
+ onClose={closeCommandPalette}
+ onExecute={commandId => executeDesktopCommand(commandId, 'palette')}
+ restorePreviousFocus={!commandPaletteReturnToSandbox}
+ />
+ ) : null}
+ {desktopUpdateRequiredDialog}
+ {environmentSetupConfirmationDialog}
+ {environmentSetupSuccessDialog}
+ {sandboxUiDeepLinkDialog}
+ {pluginConsentPrompt ? (
+ <PluginConsentModal
+ request={pluginConsentPrompt}
+ onResolve={resolvePluginConsent}
+ />
+ ) : null}
+ {pluginGfsPreview ? (
+ <GfsImagePreview
+ byteLength={pluginGfsPreview.bytes}
+ fileName={pluginGfsPreview.name}
+ gfsUri={pluginGfsPreview.gfsUri}
+ mimeType={pluginGfsPreview.mimeType}
+ onClose={closePluginGfsPreview}
+ />
+ ) : null}
+ </DesktopStateProvider>
+ </McpRuntimeProvider>
+ </AgentChatProviders>
+ </AgentActivityProvider>
+ </WorkspaceActionsProvider>
+ </NotificationsContext.Provider>
+ </NavigationContext.Provider>
+ ) : (
+ <>
+ {vm.unauthenticatedView === 'outage' ? (
+ <UnavailablePage />
+ ) : vm.unauthenticatedView === 'onboarding' ? (
+ <OnboardingPage onboarding={vm.onboarding} />
+ ) : (
+ <AuthPage />
+ )}
+ {environmentSetupConfirmationDialog}
+ {environmentSetupSuccessDialog}
+ <ToastStack items={vm.toasts} />
+ </>
+ )}
+ </div>
</div>
<BootSplash loading={bootSplashLoading} />
</AuthContext.Provider>
diff --git a/desktop-app/ui/src/components/WindowTitleBar/__tests__/WindowTitleBar.test.tsx b/desktop-app/ui/src/components/WindowTitleBar/__tests__/WindowTitleBar.test.tsx
new file mode 100644
index 000000000..8f9a99ec7
--- /dev/null
+++ b/desktop-app/ui/src/components/WindowTitleBar/__tests__/WindowTitleBar.test.tsx
@@ -0,0 +1,99 @@
+// @vitest-environment jsdom
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { WindowTitleBar, resolveWindowControlsPlatform } from '..'
+import type { WindowControlsState } from '../types'
+
+afterEach(() => {
+ cleanup()
+ vi.restoreAllMocks()
+})
+
+function setNavigatorPlatform(platform: string): void {
+ Object.defineProperty(window.navigator, 'platform', {
+ configurable: true,
+ value: platform,
+ })
+}
+
+function installWindowControls(
+ state: WindowControlsState = { fullscreen: false, maximized: false }
+) {
+ const controlsStateListeners = new Set<(nextState: WindowControlsState) => void>()
+ const api = {
+ close: vi.fn(async () => undefined),
+ getControlsState: vi.fn(async () => state),
+ minimize: vi.fn(async () => undefined),
+ onControlsStateChange: vi.fn((callback: (nextState: WindowControlsState) => void) => {
+ controlsStateListeners.add(callback)
+ return () => controlsStateListeners.delete(callback)
+ }),
+ toggleMaximize: vi.fn(async () => undefined),
+ }
+
+ Object.defineProperty(window, 'evenfire', {
+ configurable: true,
+ value: {
+ window: api,
+ },
+ })
+
+ return {
+ api,
+ emitControlsState: (nextState: WindowControlsState) => {
+ controlsStateListeners.forEach(listener => listener(nextState))
+ },
+ }
+}
+
+describe('resolveWindowControlsPlatform', () => {
+ it('maps desktop navigator platform values to the supported control styles', () => {
+ expect(resolveWindowControlsPlatform('MacIntel')).toBe('mac')
+ expect(resolveWindowControlsPlatform('Win32')).toBe('windows')
+ expect(resolveWindowControlsPlatform('Linux x86_64')).toBe('linux')
+ })
+})
+
+describe('WindowTitleBar', () => {
+ it('uses macOS traffic-light ordering and native window actions', async () => {
+ setNavigatorPlatform('MacIntel')
+ const { api } = installWindowControls()
+
+ render(<WindowTitleBar />)
+
+ const buttons = screen.getAllByRole('button')
+ expect(buttons.map(button => button.getAttribute('aria-label'))).toEqual([
+ 'Close window',
+ 'Minimize window',
+ 'Maximize window',
+ ])
+
+ fireEvent.click(screen.getByRole('button', { name: 'Close window' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Minimize window' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Maximize window' }))
+
+ expect(api.close).toHaveBeenCalledTimes(1)
+ expect(api.minimize).toHaveBeenCalledTimes(1)
+ expect(api.toggleMaximize).toHaveBeenCalledTimes(1)
+ })
+
+ it('uses the Windows/Linux icon order and updates the maximize label when restored', async () => {
+ setNavigatorPlatform('Win32')
+ const { emitControlsState } = installWindowControls({ fullscreen: false, maximized: true })
+
+ render(<WindowTitleBar />)
+
+ await screen.findByRole('button', { name: 'Restore window' })
+ expect(screen.getAllByRole('button').map(button => button.getAttribute('aria-label'))).toEqual([
+ 'Minimize window',
+ 'Restore window',
+ 'Close window',
+ ])
+
+ emitControlsState({ fullscreen: false, maximized: false })
+
+ await waitFor(() => {
+ expect(screen.getByRole('button', { name: 'Maximize window' })).toBeTruthy()
+ })
+ })
+})
diff --git a/desktop-app/ui/src/components/WindowTitleBar/index.tsx b/desktop-app/ui/src/components/WindowTitleBar/index.tsx
new file mode 100644
index 000000000..ef4e173fe
--- /dev/null
+++ b/desktop-app/ui/src/components/WindowTitleBar/index.tsx
@@ -0,0 +1,108 @@
+import React from 'react'
+import { joinClasses } from '@lib/classNames'
+import type { WindowControlAction, WindowControlsPlatform, WindowControlsState } from './types'
+
+const DEFAULT_WINDOW_CONTROLS_STATE: WindowControlsState = {
+ fullscreen: false,
+ maximized: false,
+}
+
+const MAC_CONTROL_ORDER: WindowControlAction[] = ['close', 'minimize', 'toggleMaximize']
+const DESKTOP_CONTROL_ORDER: WindowControlAction[] = ['minimize', 'toggleMaximize', 'close']
+
+export function resolveWindowControlsPlatform(platform: string): WindowControlsPlatform {
+ const normalized = platform.toLowerCase()
+ if (normalized.includes('mac')) return 'mac'
+ if (normalized.includes('win')) return 'windows'
+ return 'linux'
+}
+
+function controlLabel(action: WindowControlAction, state: WindowControlsState): string {
+ if (action === 'close') return 'Close window'
+ if (action === 'minimize') return 'Minimize window'
+ return state.fullscreen || state.maximized ? 'Restore window' : 'Maximize window'
+}
+
+function controlClassName(action: WindowControlAction): string {
+ return joinClasses('window-control-button', `window-control-button--${action}`)
+}
+
+function getWindowControlsApi() {
+ return window.evenfire?.window
+}
+
+export function WindowTitleBar() {
+ const [controlsState, setControlsState] = React.useState<WindowControlsState>(
+ DEFAULT_WINDOW_CONTROLS_STATE
+ )
+ const platform = resolveWindowControlsPlatform(window.navigator.platform || '')
+ const controlOrder = platform === 'mac' ? MAC_CONTROL_ORDER : DESKTOP_CONTROL_ORDER
+
+ React.useEffect(() => {
+ const controlsApi = getWindowControlsApi()
+ let mounted = true
+
+ void controlsApi
+ ?.getControlsState()
+ .then(state => {
+ if (mounted) setControlsState(state)
+ })
+ .catch(() => {
+ if (mounted) setControlsState(DEFAULT_WINDOW_CONTROLS_STATE)
+ })
+
+ const removeListener = controlsApi?.onControlsStateChange(nextState => {
+ setControlsState(nextState)
+ })
+
+ return () => {
+ mounted = false
+ removeListener?.()
+ }
+ }, [])
+
+ const runControl = React.useCallback((action: WindowControlAction) => {
+ const controlsApi = getWindowControlsApi()
+ if (action === 'close') {
+ void controlsApi?.close()
+ return
+ }
+ if (action === 'minimize') {
+ void controlsApi?.minimize()
+ return
+ }
+ void controlsApi?.toggleMaximize()
+ }, [])
+
+ return (
+ <header
+ className={`window-titlebar window-titlebar--platform-${platform}`}
+ data-platform={platform}
+ >
+ <div className="window-titlebar__controls" aria-label="Window controls">
+ {controlOrder.map(action => (
+ <button
+ key={action}
+ type="button"
+ aria-label={controlLabel(action, controlsState)}
+ className={controlClassName(action)}
+ onClick={() => runControl(action)}
+ >
+ <span
+ aria-hidden="true"
+ className={joinClasses(
+ 'window-control-icon',
+ `window-control-icon--${action}`,
+ action === 'toggleMaximize' &&
+ (controlsState.fullscreen || controlsState.maximized) &&
+ 'window-control-icon--restore'
+ )}
+ />
+ </button>
+ ))}
+ </div>
+ </header>
+ )
+}
+
+export type { WindowControlAction, WindowControlsPlatform, WindowControlsState } from './types'
diff --git a/desktop-app/ui/src/components/WindowTitleBar/types.ts b/desktop-app/ui/src/components/WindowTitleBar/types.ts
new file mode 100644
index 000000000..ad9add232
--- /dev/null
+++ b/desktop-app/ui/src/components/WindowTitleBar/types.ts
@@ -0,0 +1,8 @@
+export type WindowControlAction = 'close' | 'minimize' | 'toggleMaximize'
+
+export type WindowControlsPlatform = 'linux' | 'mac' | 'windows'
+
+export type WindowControlsState = {
+ fullscreen: boolean
+ maximized: boolean
+}
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index 508a648da..a4a5a1345 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -9,12 +9,21 @@ body,
min-height: 100%;
}
-/* Layout-transparent wrapper around the app/auth tree. It only exists so the
- BootSplash overlay can mark the whole background subtree `inert` during the
- startup/loading window, removing hidden controls from the tab order and
- accessibility tree until the splash exits. */
+.app-frame {
+ min-height: 100vh;
+ display: grid;
+ grid-template-rows: var(--window-titlebar-height) minmax(0, 1fr);
+ background: var(--topbar-gradient);
+}
+
+/* Root wrapper around the app/auth tree. It exists so the BootSplash overlay
+ can mark the whole background subtree `inert` during the startup/loading
+ window, removing hidden controls from the tab order and accessibility tree
+ until the splash exits. */
.app-root {
- display: contents;
+ min-height: 0;
+ display: block;
+ background: var(--bg);
}
body {
@@ -62,7 +71,7 @@ h3 {
}
.app-shell {
- min-height: 100vh;
+ min-height: calc(100vh - var(--window-titlebar-height));
display: grid;
grid-template-columns: auto minmax(0, 1fr);
gap: 0;
@@ -70,6 +79,150 @@ h3 {
width: 100%;
}
+.window-titlebar {
+ height: var(--window-titlebar-height);
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ padding: 0 var(--space-2);
+ background: var(--topbar-gradient);
+ border-bottom: 1px solid rgba(var(--edge-rgb), 0.28);
+ user-select: none;
+ -webkit-app-region: drag;
+}
+
+.window-titlebar__controls {
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ gap: var(--space-1);
+ min-width: calc((var(--window-titlebar-control-size) * 3) + (var(--space-1) * 2));
+ -webkit-app-region: no-drag;
+}
+
+.window-control-button {
+ position: relative;
+ width: var(--window-titlebar-control-size);
+ min-width: var(--window-titlebar-control-size);
+ height: var(--window-titlebar-control-size);
+ min-height: var(--window-titlebar-control-size);
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0;
+ border: 1px solid transparent;
+ border-radius: var(--radius-sm);
+ background: transparent;
+ box-shadow: none;
+ color: var(--text-muted);
+ -webkit-app-region: no-drag;
+}
+
+.window-control-button:hover:enabled {
+ background: var(--surface-hover);
+ color: var(--text);
+}
+
+.window-control-button:focus-visible {
+ border-color: rgba(var(--focus-rgb), 0.6);
+ box-shadow: 0 0 0 2px rgba(var(--focus-rgb), 0.24);
+}
+
+.window-control-icon {
+ position: relative;
+ width: 12px;
+ height: 12px;
+ display: inline-block;
+ color: currentColor;
+}
+
+.window-control-icon--minimize::before {
+ content: '';
+ position: absolute;
+ left: 1px;
+ right: 1px;
+ bottom: 3px;
+ border-bottom: 1.5px solid currentColor;
+}
+
+.window-control-icon--toggleMaximize::before,
+.window-control-icon--toggleMaximize::after {
+ content: '';
+ position: absolute;
+ border: 1.5px solid currentColor;
+}
+
+.window-control-icon--toggleMaximize::before {
+ inset: 1px;
+}
+
+.window-control-icon--restore::before {
+ inset: 4px 1px 1px 4px;
+}
+
+.window-control-icon--restore::after {
+ inset: 1px 4px 4px 1px;
+}
+
+.window-control-icon--close::before,
+.window-control-icon--close::after {
+ content: '';
+ position: absolute;
+ top: 5px;
+ left: 1px;
+ width: 10px;
+ border-bottom: 1.5px solid currentColor;
+}
+
+.window-control-icon--close::before {
+ transform: rotate(45deg);
+}
+
+.window-control-icon--close::after {
+ transform: rotate(-45deg);
+}
+
+.window-titlebar--platform-mac .window-titlebar__controls {
+ gap: var(--space-1);
+ min-width: calc((var(--window-titlebar-mac-control-size) * 3) + (var(--space-1) * 2));
+}
+
+.window-titlebar--platform-mac .window-control-button {
+ width: var(--window-titlebar-mac-control-size);
+ min-width: var(--window-titlebar-mac-control-size);
+ height: var(--window-titlebar-mac-control-size);
+ min-height: var(--window-titlebar-mac-control-size);
+ border-color: var(--window-control-mac-border);
+ border-radius: 999px;
+}
+
+.window-titlebar--platform-mac .window-control-button--close {
+ background: var(--window-control-mac-close);
+}
+
+.window-titlebar--platform-mac .window-control-button--minimize {
+ background: var(--window-control-mac-minimize);
+}
+
+.window-titlebar--platform-mac .window-control-button--toggleMaximize {
+ background: var(--window-control-mac-expand);
+}
+
+.window-titlebar--platform-mac .window-control-button:hover:enabled {
+ border-color: var(--window-control-mac-border);
+}
+
+.window-titlebar--platform-mac .window-control-icon {
+ opacity: 0;
+ transform: scale(0.72);
+ color: rgba(var(--overlay-rgb), 0.72);
+}
+
+.window-titlebar--platform-mac .window-titlebar__controls:hover .window-control-icon,
+.window-titlebar--platform-mac .window-control-button:focus-visible .window-control-icon {
+ opacity: 1;
+}
+
.top-bar {
position: absolute;
top: var(--space-4);
@@ -1054,12 +1207,12 @@ h3 {
overflow: visible;
display: grid;
grid-template-rows: minmax(0, 1fr);
- min-height: 100vh;
+ min-height: calc(100vh - var(--window-titlebar-height));
}
.left-nav {
--sidebar-flyout-layer: calc(var(--layer-dropdown) + 1000);
- --sidebar-height: 100vh;
+ --sidebar-height: calc(100vh - var(--window-titlebar-height));
--sidebar-logo-brand-gap: 4px;
--sidebar-logo-pad-top: 8px;
--sidebar-nav-parent-pad-x: var(--space-1);
@@ -2203,7 +2356,7 @@ h3 {
drawer's min-width (see useChatDrawerResize). */
--chat-drawer-width: clamp(340px, 32vw, 420px);
- height: 100vh;
+ height: calc(100vh - var(--window-titlebar-height));
min-height: 0;
overflow: hidden;
overflow-x: hidden;
@@ -2226,7 +2379,7 @@ h3 {
flex-direction: column;
overflow: hidden;
min-height: 0;
- height: 100vh;
+ height: calc(100vh - var(--window-titlebar-height));
padding: var(--space-4) var(--space-4) 0;
gap: 0;
}
@@ -2244,7 +2397,7 @@ h3 {
flex-direction: column;
overflow: hidden;
min-height: 0;
- height: 100vh;
+ height: calc(100vh - var(--window-titlebar-height));
/* Top pad clears the absolute top-bar: its space-2 top offset + the header's
own height + a bit of gap below it. space-2 * 5 is the smallest step of the
spacing scale that covers that stack; the other three sides are just space-2. */
@@ -2271,7 +2424,7 @@ h3 {
flex-direction: column;
overflow: hidden;
min-height: 0;
- height: 100vh;
+ height: calc(100vh - var(--window-titlebar-height));
padding: var(--space-4) var(--space-4) 0;
gap: var(--space-2-5);
}
@@ -9994,7 +10147,7 @@ button.page-breadcrumb-link--plain-action:hover:enabled {
}
.auth-page {
- min-height: 100vh;
+ min-height: calc(100vh - var(--window-titlebar-height));
padding: var(--space-5);
display: grid;
place-items: center;
@@ -10027,7 +10180,7 @@ button.page-breadcrumb-link--plain-action:hover:enabled {
--boot-exit-duration: 240ms;
position: fixed;
- inset: 0;
+ inset: var(--window-titlebar-height) 0 0 0;
z-index: 9999;
display: grid;
place-items: center;
diff --git a/desktop-app/ui/src/styles/tokens.css b/desktop-app/ui/src/styles/tokens.css
index 637653c63..0e4f4ca26 100644
--- a/desktop-app/ui/src/styles/tokens.css
+++ b/desktop-app/ui/src/styles/tokens.css
@@ -151,6 +151,13 @@
/* Layout */
--search-bar-min-width: 320px;
--avatar-size: 40px;
+ --window-titlebar-height: 38px;
+ --window-titlebar-control-size: 28px;
+ --window-titlebar-mac-control-size: 12px;
+ --window-control-mac-close: rgb(255, 95, 87);
+ --window-control-mac-minimize: rgb(255, 189, 46);
+ --window-control-mac-expand: rgb(40, 201, 64);
+ --window-control-mac-border: rgba(var(--overlay-rgb), 0.28);
/* chat-view session tabs (Chrome-style: shrink to a floor, cap at a ceiling) */
--chat-tab-max: 220px;