The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
Improve Windows desktop window controls and shutdown
Steven Enamakelc7407fdc6a39
diff --git a/app/src/App.tsx b/app/src/App.tsxindex 972cdcc3c1..d919f01707 100644--- a/app/src/App.tsx+++ b/app/src/App.tsx@@ -24,6 +24,10 @@ import KeyringConsentOverlay from './components/keyring/KeyringConsentOverlay';import AppSidebar from './components/layout/shell/AppSidebar';import RootShellLayout from './components/layout/shell/RootShellLayout';import { SidebarSlotProvider } from './components/layout/shell/SidebarSlot';+import WindowDragBar from './components/layout/shell/WindowDragBar';+import WindowsWindowControls, {+ isWindowsDesktop,+} from './components/layout/shell/WindowsWindowControls';import LocalAIDownloadSnackbar from './components/LocalAIDownloadSnackbar';import NoticeCenter from './components/notices/NoticeCenter';import OpenhumanLinkModal from './components/OpenhumanLinkModal';@@ -116,48 +120,52 @@ function App() {* @end-source:provider-chain*/return (- <Sentry.ErrorBoundary- fallback={({ error, componentStack, resetError, eventId }) => (- <ErrorFallbackScreen- error={error}- componentStack={componentStack}- eventId={eventId}- onReset={resetError}- />- )}>- <Provider store={store}>- <PersistGate loading={<PersistRehydrationScreen />} persistor={persistor}>- <ThemeProvider>- <I18nProvider>- <BootCheckGate>- <CoreStateProvider>- {socketWrapped(- <ChatRuntimeProvider>- <Router>- <CommandProvider>- <ServiceBlockingGate>- <AnalyticsPageTracker />- <AppShell />- <SecurityBanner />- {!onMobile && <DictationHotkeyManager />}- {!onMobile && <PttHotkeyManager />}- {!onMobile && <LocalAIDownloadSnackbar />}- {!onMobile && <AppUpdatePrompt />}- <KeyringConsentOverlay />- <HarnessInitOverlay />- <AnnouncementGate />- </ServiceBlockingGate>- </CommandProvider>- </Router>- </ChatRuntimeProvider>- )}- </CoreStateProvider>- </BootCheckGate>- </I18nProvider>- </ThemeProvider>- </PersistGate>- </Provider>- </Sentry.ErrorBoundary>+ <div className={`relative h-screen overflow-hidden ${isWindowsDesktop() ? 'rounded-xs' : ''}`}>+ {!onMobile && <WindowDragBar />}+ <Sentry.ErrorBoundary+ fallback={({ error, componentStack, resetError, eventId }) => (+ <ErrorFallbackScreen+ error={error}+ componentStack={componentStack}+ eventId={eventId}+ onReset={resetError}+ />+ )}>+ <Provider store={store}>+ <PersistGate loading={<PersistRehydrationScreen />} persistor={persistor}>+ <ThemeProvider>+ <I18nProvider>+ {!onMobile && <WindowsWindowControls />}+ <BootCheckGate>+ <CoreStateProvider>+ {socketWrapped(+ <ChatRuntimeProvider>+ <Router>+ <CommandProvider>+ <ServiceBlockingGate>+ <AnalyticsPageTracker />+ <AppShell />+ <SecurityBanner />+ {!onMobile && <DictationHotkeyManager />}+ {!onMobile && <PttHotkeyManager />}+ {!onMobile && <LocalAIDownloadSnackbar />}+ {!onMobile && <AppUpdatePrompt />}+ <KeyringConsentOverlay />+ <HarnessInitOverlay />+ <AnnouncementGate />+ </ServiceBlockingGate>+ </CommandProvider>+ </Router>+ </ChatRuntimeProvider>+ )}+ </CoreStateProvider>+ </BootCheckGate>+ </I18nProvider>+ </ThemeProvider>+ </PersistGate>+ </Provider>+ </Sentry.ErrorBoundary>+ </div>);}diff --git a/app/src/components/layout/shell/AppSidebar.test.tsx b/app/src/components/layout/shell/AppSidebar.test.tsxindex 1168ce7fec..653d7f17f9 100644--- a/app/src/components/layout/shell/AppSidebar.test.tsx+++ b/app/src/components/layout/shell/AppSidebar.test.tsx@@ -5,6 +5,9 @@ import { renderWithProviders } from '../../../test/test-utils';import { SidebarProvider } from '../../ui';import AppSidebar from './AppSidebar';+const mockIsWindowsDesktop = vi.fn(() => false);+vi.mock('./WindowsWindowControls', () => ({ isWindowsDesktop: () => mockIsWindowsDesktop() }));+/** `AppSidebar` reads `useSidebar()` — it must render inside a `<SidebarProvider>`. */function renderAppSidebar(options?: Parameters<typeof renderWithProviders>[1],@@ -74,7 +77,10 @@ vi.mock('./SidebarAppRail', () => ({ default: () => null }));// bypassing the mocked SidebarHeader/SidebarNav above so the real collapsed// branch (drag strip, reopen trigger, CollapsedNavRail) is under test.describe('AppSidebar — collapsed rail', () => {- beforeEach(() => vi.clearAllMocks());+ beforeEach(() => {+ vi.clearAllMocks();+ mockIsWindowsDesktop.mockReturnValue(false);+ });it('renders the reopen trigger and collapsed nav rail instead of the header/nav', () => {renderAppSidebar({ initialEntries: ['/chat'] }, { open: false });@@ -92,6 +98,14 @@ describe('AppSidebar — collapsed rail', () => {expect(spacer).toHaveClass('mb-2');});+ it('uses a smaller top gap for collapsed controls on Windows', () => {+ mockIsWindowsDesktop.mockReturnValue(true);+ const { container } = renderAppSidebar({ initialEntries: ['/chat'] }, { open: false });+ const spacer = container.querySelector('.w-full.flex-none');+ expect(spacer).toHaveClass('h-2', 'mb-1');+ expect(screen.getByTestId('root-shell-reopen')).toBeInTheDocument();+ });+// The drag region is the whole column, not just that strip. `drag.js` drags a// bare region only on a direct hit, so the 28px of column either side of each// 32px rail button — the band sitting between the traffic lights and the raildiff --git a/app/src/components/layout/shell/AppSidebar.tsx b/app/src/components/layout/shell/AppSidebar.tsxindex 33c4b0b59d..6fc4a0b44c 100644--- a/app/src/components/layout/shell/AppSidebar.tsx+++ b/app/src/components/layout/shell/AppSidebar.tsx@@ -15,6 +15,7 @@ import CollapsedNavRail from './CollapsedNavRail';import SidebarHeader from './SidebarHeader';import SidebarNav from './SidebarNav';import { SidebarSlotOutlet } from './SidebarSlot';+import { isWindowsDesktop } from './WindowsWindowControls';const log = debugFactory('sidebar');@@ -107,8 +108,9 @@ export default function AppSidebar() {right-aligning, but this narrow rail can't — so reserve a strip theheight of the window controls and start the rail below it, clear ofthe lights. It carries no drag region of its own: the column above- already drags, and this only has to hold that height open. */}- <div className="mb-2 h-7 w-full flex-none" />+ already drags, and this only has to hold that height open. Windows+ keeps a smaller gap so the first icon does not hug the edge. */}+ <div className={`w-full flex-none ${isWindowsDesktop() ? 'mb-1 h-2' : 'mb-2 h-7'}`} /><Tooltip label={t('layout.showSidebar')}>{/* The primitive's own trigger, so reopening goes through the samecontrolled `onOpenChange` `RootShellLayout` drives every otherdiff --git a/app/src/components/layout/shell/RootShellLayout.tsx b/app/src/components/layout/shell/RootShellLayout.tsxindex 6ffdb33006..b573c70e9d 100644--- a/app/src/components/layout/shell/RootShellLayout.tsx+++ b/app/src/components/layout/shell/RootShellLayout.tsx@@ -21,7 +21,6 @@ import {SidebarRail,} from '../../ui';import ContentSurface from './ContentSurface';-import WindowDragBar from './WindowDragBar';const log = debugFactory('sidebar');@@ -298,11 +297,6 @@ export default function RootShellLayout({<divclassName="relative flex w-full min-w-0 flex-1 flex-col overflow-hidden"data-testid="root-shell-content">- {/* Empty macOS overlay-title-bar band. It is absolutely positioned and- fully transparent, so it is draggable without shifting or painting- over the page. No-op off macOS / outside Tauri, where the native- title bar owns this area. */}- <WindowDragBar /><ContentSurface unframed={unframed}><divdata-testid="root-shell-routed-content"diff --git a/app/src/components/layout/shell/SidebarHeader.test.tsx b/app/src/components/layout/shell/SidebarHeader.test.tsxindex bb3a099831..dfcf6d87cb 100644--- a/app/src/components/layout/shell/SidebarHeader.test.tsx+++ b/app/src/components/layout/shell/SidebarHeader.test.tsx@@ -7,6 +7,8 @@ import SidebarHeader from './SidebarHeader';const mockNavigate = vi.fn();const mockHide = vi.fn();+const mockIsWindowsDesktop = vi.fn(() => false);+vi.mock('./WindowsWindowControls', () => ({ isWindowsDesktop: () => mockIsWindowsDesktop() }));vi.mock('react-router-dom', async importOriginal => {const actual = await importOriginal<typeof import('react-router-dom')>();@@ -19,7 +21,16 @@ vi.mock('../../../utils/openUrl', () => ({ openUrl: (...args: unknown[]) => openvi.mock('../../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (k: string) => k }) }));describe('SidebarHeader', () => {- beforeEach(() => vi.clearAllMocks());+ beforeEach(() => {+ vi.clearAllMocks();+ mockIsWindowsDesktop.mockReturnValue(false);+ });++ it('centers the utility icons on Windows', () => {+ mockIsWindowsDesktop.mockReturnValue(true);+ const { container } = renderWithProviders(<SidebarHeader />, { initialEntries: ['/home'] });+ expect(container.querySelector('[data-tauri-drag-region]')).toHaveClass('justify-center');+ });it('renders Discord, Search, Settings, and Collapse buttons', () => {renderWithProviders(<SidebarHeader />, { initialEntries: ['/home'] });diff --git a/app/src/components/layout/shell/SidebarHeader.tsx b/app/src/components/layout/shell/SidebarHeader.tsxindex 4aead1be25..52912ffe18 100644--- a/app/src/components/layout/shell/SidebarHeader.tsx+++ b/app/src/components/layout/shell/SidebarHeader.tsx@@ -8,6 +8,7 @@ import { DISCORD_INVITE_URL } from '../../../utils/links';import { openUrl } from '../../../utils/openUrl';import { Button, SidebarHeader as SidebarHeaderShell, Tooltip } from '../../ui';import { useRootSidebar } from './RootShellLayout';+import { isWindowsDesktop } from './WindowsWindowControls';/** The community destination opened by the Discord button. */export const DISCORD_URL = DISCORD_INVITE_URL;@@ -35,11 +36,10 @@ export default function SidebarHeader() {return (// The primitive supplies the horizontal and bottom inset; this overrides// its top inset to align the row to the title-bar centreline, then turns it- // into a right-aligned row. Right-aligned so the macOS traffic- // lights (top-left, overlay title bar) sit in the empty left space — the- // icons stay clear of the window controls and inline with them.+ // into a right-aligned row on macOS. The traffic lights sit in the empty+ // left space. Windows has no controls in this corner, so center the row.//- // The icons deliberately do NOT move to meet the lights: this row's+ // On macOS the icons deliberately do NOT move to meet the lights: this row's// vertical rhythm is the sidebar's, shared with `SidebarNav` below it, and// pulling it up to the window's edge to chase a platform control would bend// the app's own spacing around one OS's chrome. The lights are moved to@@ -87,7 +87,7 @@ export default function SidebarHeader() {// correct on a band with no children — see `WindowDragBar`.<SidebarHeaderShelldata-tauri-drag-region="deep"- className="flex-row items-center justify-end gap-1 pt-[7px]">+ className={`flex-row items-center gap-1 pt-[7px] ${isWindowsDesktop() ? 'justify-center' : 'justify-end'}`}><div className="flex items-center gap-0.5">{/* Community Discord — opens the invite in the system browser. This slotheld the keyboard-shortcuts help; that directory is still onediff --git a/app/src/components/layout/shell/WindowDragBar.test.tsx b/app/src/components/layout/shell/WindowDragBar.test.tsxindex f3f01dc5a4..1d62c4e655 100644--- a/app/src/components/layout/shell/WindowDragBar.test.tsx+++ b/app/src/components/layout/shell/WindowDragBar.test.tsx@@ -6,13 +6,19 @@ import WindowDragBar, { WINDOW_DRAG_BAR_HEIGHT } from './WindowDragBar';// Both gates are mocked so we can drive every platform combination.const isMac = vi.fn();const isTauri = vi.fn();+const isWindowsDesktop = vi.fn();vi.mock('../../../lib/commands/shortcut', () => ({ isMac: () => isMac() }));vi.mock('../../../utils/tauriCommands/common', () => ({ isTauri: () => isTauri() }));+vi.mock('./WindowsWindowControls', () => ({+ isWindowsDesktop: () => isWindowsDesktop(),+ WINDOWS_WINDOW_CONTROLS_WIDTH: 138,+}));describe('WindowDragBar', () => {beforeEach(() => {isMac.mockReset();isTauri.mockReset();+ isWindowsDesktop.mockReset();});afterEach(cleanup);@@ -23,6 +29,7 @@ describe('WindowDragBar', () => {const bar = container.querySelector('[data-tauri-drag-region]');expect(bar).not.toBeNull();expect((bar as HTMLElement).style.height).toBe(`${WINDOW_DRAG_BAR_HEIGHT}px`);+ expect((bar as HTMLElement).style.left).toBe('428px');expect((bar as HTMLElement).className).toContain('absolute');expect((bar as HTMLElement).className).toContain('bg-transparent');});@@ -55,4 +62,14 @@ describe('WindowDragBar', () => {const { container } = render(<WindowDragBar />);expect(container.querySelector('[data-tauri-drag-region]')).toBeNull();});++ it('leaves room for the custom window controls on Windows', () => {+ isMac.mockReturnValue(false);+ isTauri.mockReturnValue(true);+ isWindowsDesktop.mockReturnValue(true);+ const { container } = render(<WindowDragBar />);+ const bar = container.querySelector('[data-tauri-drag-region]') as HTMLElement;+ expect(bar).not.toBeNull();+ expect(bar.style.right).toBe('138px');+ });});diff --git a/app/src/components/layout/shell/WindowDragBar.tsx b/app/src/components/layout/shell/WindowDragBar.tsxindex e2c894b45a..c3b7747a73 100644--- a/app/src/components/layout/shell/WindowDragBar.tsx+++ b/app/src/components/layout/shell/WindowDragBar.tsx@@ -1,11 +1,14 @@import { isMac } from '../../../lib/commands/shortcut';import { isTauri } from '../../../utils/tauriCommands/common';+import { SIDEBAR_MAX_WIDTH } from '../../ui';+import { isWindowsDesktop, WINDOWS_WINDOW_CONTROLS_WIDTH } from './WindowsWindowControls';/*** Height (px) of the drag strip. Matches the macOS traffic-light zone so the* native window controls sit within the band.*/export const WINDOW_DRAG_BAR_HEIGHT = 32;+const GLOBAL_DRAG_BAR_LEFT = SIDEBAR_MAX_WIDTH + 8;/*** Transparent macOS window-drag band for the overlay title bar.@@ -16,9 +19,9 @@ export const WINDOW_DRAG_BAR_HEIGHT = 32;* webview captures the pointer events. We opt back in with a `data-tauri-drag-* region` band.*- * Absolutely overlaid above the routed surface, so it contributes no layout- * height and never shifts page content. It paints nothing: the routed content- * remains fully visible through the draggable hit-area.+ * Absolutely overlaid above every desktop screen, including boot and error+ * states. It contributes no layout height and paints nothing. Its left edge+ * clears the sidebar's maximum width so it never blocks sidebar buttons.** Native child webviews composite above HTML and cannot be dragged through;* that is a platform limit, not this band. The sidebar is intentionally@@ -30,19 +33,22 @@ export const WINDOW_DRAG_BAR_HEIGHT = 32;* element. Keep it childless: a container needs `="deep"` instead, or only its* own uncovered box drags. `SidebarHeader` and `AppSidebar` were that bug.*- * macOS-only: Windows/Linux keep their native decorated title bar (the- * `Overlay` style is a no-op there), so reserving a band would only waste- * vertical space. Outside the Tauri runtime (browser/iOS) there is no window to- * drag, so it renders nothing.+ * Windows uses the same drag band with room left for its custom controls.+ * Linux keeps its native decorated title bar. Outside Tauri it renders nothing.*/export default function WindowDragBar() {- if (!isTauri() || !isMac()) return null;+ if (!isTauri() || (!isMac() && !isWindowsDesktop())) return null;+ const windows = isWindowsDesktop();return (<divdata-tauri-drag-regionaria-hidden="true"- className="absolute inset-x-0 top-0 z-20 bg-transparent"- style={{ height: WINDOW_DRAG_BAR_HEIGHT }}+ className="absolute top-0 z-50 bg-transparent"+ style={{+ height: WINDOW_DRAG_BAR_HEIGHT,+ left: GLOBAL_DRAG_BAR_LEFT,+ right: windows ? WINDOWS_WINDOW_CONTROLS_WIDTH : 0,+ }}/>);}diff --git a/app/src/components/layout/shell/WindowsWindowControls.test.tsx b/app/src/components/layout/shell/WindowsWindowControls.test.tsxnew file mode 100644index 0000000000..49a112abc6--- /dev/null+++ b/app/src/components/layout/shell/WindowsWindowControls.test.tsx@@ -0,0 +1,38 @@+import { fireEvent, render, screen } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import WindowsWindowControls from './WindowsWindowControls';++const { minimizeWindow, maximizeWindow, quitApp } = vi.hoisted(() => ({+ minimizeWindow: vi.fn(),+ maximizeWindow: vi.fn(),+ quitApp: vi.fn(),+}));++vi.mock('../../../utils/tauriCommands/common', () => ({ isTauri: () => true }));+vi.mock('../../../utils/tauriCommands/window', () => ({ minimizeWindow, maximizeWindow, quitApp }));+vi.mock('@tauri-apps/api/window', () => ({+ getCurrentWindow: () => ({+ isMaximized: () => Promise.resolve(false),+ onResized: () => Promise.resolve(() => {}),+ }),+}));++describe('WindowsWindowControls', () => {+ const platform = navigator.platform;++ beforeEach(() => {+ Object.defineProperty(navigator, 'platform', { configurable: true, value: 'Win32' });+ vi.clearAllMocks();+ });++ afterEach(() => {+ Object.defineProperty(navigator, 'platform', { configurable: true, value: platform });+ });++ it('uses the full app quit path for the close button', () => {+ render(<WindowsWindowControls />);+ fireEvent.click(screen.getByRole('button', { name: 'Close' }));+ expect(quitApp).toHaveBeenCalledTimes(1);+ });+});diff --git a/app/src/components/layout/shell/WindowsWindowControls.tsx b/app/src/components/layout/shell/WindowsWindowControls.tsxnew file mode 100644index 0000000000..92d5d1589b--- /dev/null+++ b/app/src/components/layout/shell/WindowsWindowControls.tsx@@ -0,0 +1,78 @@+import { getCurrentWindow } from '@tauri-apps/api/window';+import { useEffect, useState } from 'react';+import { LuCopy, LuMinus, LuSquare, LuX } from 'react-icons/lu';++import { useT } from '../../../lib/i18n/I18nContext';+import { isTauri } from '../../../utils/tauriCommands/common';+import { maximizeWindow, minimizeWindow, quitApp } from '../../../utils/tauriCommands/window';++export const WINDOWS_WINDOW_CONTROLS_WIDTH = 138;++export function isWindowsDesktop(): boolean {+ return isTauri() && typeof navigator !== 'undefined' && /win/i.test(navigator.platform);+}++function WindowControls() {+ const { t } = useT();+ const [maximized, setMaximized] = useState(false);++ useEffect(() => {+ const window = getCurrentWindow();+ let mounted = true;+ void window.isMaximized().then(value => {+ if (mounted) setMaximized(value);+ });+ const unlisten = window.onResized(() => {+ void window.isMaximized().then(value => {+ if (mounted) setMaximized(value);+ });+ });+ return () => {+ mounted = false;+ void unlisten.then(stop => stop());+ };+ }, []);++ const buttonClass =+ 'flex h-8 w-[46px] items-center justify-center text-content-primary transition-colors hover:bg-content-faint/60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-content-primary';++ return (+ <div+ className="absolute right-0 top-0 z-50 flex h-8 select-none"+ style={{ width: WINDOWS_WINDOW_CONTROLS_WIDTH }}>+ <button+ type="button"+ className={buttonClass}+ aria-label={t('window.minimize')}+ title={t('window.minimize')}+ onClick={() => void minimizeWindow()}>+ <LuMinus aria-hidden="true" className="h-4 w-4" />+ </button>+ <button+ type="button"+ className={buttonClass}+ aria-label={t(maximized ? 'window.restore' : 'window.maximize')}+ title={t(maximized ? 'window.restore' : 'window.maximize')}+ onClick={() => void maximizeWindow()}>+ {maximized ? (+ <LuCopy aria-hidden="true" className="h-3.5 w-3.5" />+ ) : (+ <LuSquare aria-hidden="true" className="h-3.5 w-3.5" />+ )}+ </button>+ <button+ type="button"+ className={`${buttonClass} hover:bg-red-600 hover:text-white`}+ aria-label={t('common.close')}+ title={t('common.close')}+ onClick={() => void quitApp()}>+ <LuX aria-hidden="true" className="h-4 w-4" />+ </button>+ </div>+ );+}++export default function WindowsWindowControls() {+ if (!isWindowsDesktop()) return null;+ return <WindowControls />;+}diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.tsindex 66e90bad37..7183547e70 100644--- a/app/src/lib/i18n/ar.ts+++ b/app/src/lib/i18n/ar.ts@@ -388,6 +388,9 @@ const messages: TranslationMap = {'common.back': 'رجوع','common.next': 'التالي','common.finish': 'إنهاء',+ 'window.minimize': 'تصغير',+ 'window.maximize': 'تكبير',+ 'window.restore': 'استعادة','common.close': 'إغلاق','notices.title': 'الإشعارات','common.enabled': 'مفعّل',diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.tsindex d4d0a647ba..08fda2a07b 100644--- a/app/src/lib/i18n/bn.ts+++ b/app/src/lib/i18n/bn.ts@@ -403,6 +403,9 @@ const messages: TranslationMap = {'common.back': 'পেছনে','common.next': 'পরবর্তী','common.finish': 'সম্পন্ন',+ 'window.minimize': 'ছোট করুন',+ 'window.maximize': 'বড় করুন',+ 'window.restore': 'পুনরুদ্ধার করুন','common.close': 'বন্ধ করুন','notices.title': 'বিজ্ঞপ্তি','common.enabled': 'সক্রিয়',diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.tsindex 94b620fe3f..eeab6a6a2f 100644--- a/app/src/lib/i18n/de.ts+++ b/app/src/lib/i18n/de.ts@@ -424,6 +424,9 @@ const messages: TranslationMap = {'common.back': 'Zurück','common.next': 'Weiter','common.finish': 'Fertig',+ 'window.minimize': 'Minimieren',+ 'window.maximize': 'Maximieren',+ 'window.restore': 'Wiederherstellen','common.close': 'Schließen','notices.title': 'Benachrichtigungen','common.enabled': 'Aktiviert',diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.tsindex 12c3a89dd8..5a09daebfe 100644--- a/app/src/lib/i18n/en.ts+++ b/app/src/lib/i18n/en.ts@@ -176,6 +176,9 @@ const en: TranslationMap = {'common.back': 'Back','common.next': 'Next','common.finish': 'Finish',+ 'window.minimize': 'Minimize',+ 'window.maximize': 'Maximize',+ 'window.restore': 'Restore','common.close': 'Close','notices.title': 'Notifications','common.enabled': 'Enabled',diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.tsindex b2d713eb01..f55c5f33df 100644--- a/app/src/lib/i18n/es.ts+++ b/app/src/lib/i18n/es.ts@@ -414,6 +414,9 @@ const messages: TranslationMap = {'common.back': 'Atrás','common.next': 'Siguiente','common.finish': 'Finalizar',+ 'window.minimize': 'Minimizar',+ 'window.maximize': 'Maximizar',+ 'window.restore': 'Restaurar','common.close': 'Cerrar','notices.title': 'Notificaciones','common.enabled': 'Activado',diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.tsindex b62ce839e6..6aac6b99dd 100644--- a/app/src/lib/i18n/fr.ts+++ b/app/src/lib/i18n/fr.ts@@ -421,6 +421,9 @@ const messages: TranslationMap = {'common.back': 'Retour','common.next': 'Suivant','common.finish': 'Terminer',+ 'window.minimize': 'Réduire',+ 'window.maximize': 'Agrandir',+ 'window.restore': 'Restaurer','common.close': 'Fermer','notices.title': 'Notifications','common.enabled': 'Activé',diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.tsindex 57e8b016e3..7d89858d50 100644--- a/app/src/lib/i18n/hi.ts+++ b/app/src/lib/i18n/hi.ts@@ -405,6 +405,9 @@ const messages: TranslationMap = {'common.back': 'वापस','common.next': 'आगे','common.finish': 'पूरा करें',+ 'window.minimize': 'छोटा करें',+ 'window.maximize': 'बड़ा करें',+ 'window.restore': 'पुनर्स्थापित करें','common.close': 'बंद करें','notices.title': 'सूचनाएं','common.enabled': 'चालू है',diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.tsindex 1fa3586195..7a6fb17eab 100644--- a/app/src/lib/i18n/id.ts+++ b/app/src/lib/i18n/id.ts@@ -409,6 +409,9 @@ const messages: TranslationMap = {'common.back': 'Kembali','common.next': 'Berikutnya','common.finish': 'Selesai',+ 'window.minimize': 'Minimalkan',+ 'window.maximize': 'Maksimalkan',+ 'window.restore': 'Pulihkan','common.close': 'Tutup','notices.title': 'Notifikasi','common.enabled': 'Aktif',diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.tsindex 69d1fcb0e8..42b396024e 100644--- a/app/src/lib/i18n/it.ts+++ b/app/src/lib/i18n/it.ts@@ -415,6 +415,9 @@ const messages: TranslationMap = {'common.back': 'Indietro','common.next': 'Avanti','common.finish': 'Fine',+ 'window.minimize': 'Riduci',+ 'window.maximize': 'Ingrandisci',+ 'window.restore': 'Ripristina','common.close': 'Chiudi','notices.title': 'Notifiche','common.enabled': 'Abilitato',diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.tsindex 0a1e64e9ff..2474e9d2f0 100644--- a/app/src/lib/i18n/ko.ts+++ b/app/src/lib/i18n/ko.ts@@ -399,6 +399,9 @@ const messages: TranslationMap = {'common.back': '뒤로','common.next': '다음','common.finish': '완료',+ 'window.minimize': '최소화',+ 'window.maximize': '최대화',+ 'window.restore': '복원','common.close': '닫기','notices.title': '알림','common.enabled': '활성화됨',diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.tsindex 2b00711d3f..b217a1fdfd 100644--- a/app/src/lib/i18n/pl.ts+++ b/app/src/lib/i18n/pl.ts@@ -414,6 +414,9 @@ const messages: TranslationMap = {'common.back': 'Wstecz','common.next': 'Dalej','common.finish': 'Zakończ',+ 'window.minimize': 'Minimalizuj',+ 'window.maximize': 'Maksymalizuj',+ 'window.restore': 'Przywróć','common.close': 'Zamknij','notices.title': 'Powiadomienia','common.enabled': 'Włączone',diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.tsindex 017614cb6c..22ad315144 100644--- a/app/src/lib/i18n/pt.ts+++ b/app/src/lib/i18n/pt.ts@@ -411,6 +411,9 @@ const messages: TranslationMap = {'common.back': 'Voltar','common.next': 'Próximo','common.finish': 'Concluir',+ 'window.minimize': 'Minimizar',+ 'window.maximize': 'Maximizar',+ 'window.restore': 'Restaurar','common.close': 'Fechar','notices.title': 'Notificações','common.enabled': 'Ativado',diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.tsindex 4bc8586e27..c3ae34426d 100644--- a/app/src/lib/i18n/ru.ts+++ b/app/src/lib/i18n/ru.ts@@ -409,6 +409,9 @@ const messages: TranslationMap = {'common.back': 'Назад','common.next': 'Далее','common.finish': 'Завершить',+ 'window.minimize': 'Свернуть',+ 'window.maximize': 'Развернуть',+ 'window.restore': 'Восстановить','common.close': 'Закрыть','notices.title': 'Уведомления','common.enabled': 'Включено',diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.tsindex 3a8c3447c7..1dd4d4c9af 100644--- a/app/src/lib/i18n/zh-CN.ts+++ b/app/src/lib/i18n/zh-CN.ts@@ -372,6 +372,9 @@ const messages: TranslationMap = {'common.back': '返回','common.next': '下一步','common.finish': '完成',+ 'window.minimize': '最小化',+ 'window.maximize': '最大化',+ 'window.restore': '还原','common.close': '关闭','notices.title': '通知','common.enabled': '已启用',diff --git a/app/src/utils/tauriCommands/window.ts b/app/src/utils/tauriCommands/window.tsindex bd80ece3cf..8a2555356f 100644--- a/app/src/utils/tauriCommands/window.ts+++ b/app/src/utils/tauriCommands/window.ts@@ -95,6 +95,12 @@ export async function closeWindow(): Promise<void> {await getCurrentWindow().close();}+/** Exit the desktop host and its embedded core. */+export async function quitApp(): Promise<void> {+ if (!isTauri()) return;+ await invoke('app_quit');+}+/*** Set the window title*/diff --git a/crates/openhuman-app/capabilities/default.json b/crates/openhuman-app/capabilities/default.jsonindex 488539bf5d..55872c0c97 100644--- a/crates/openhuman-app/capabilities/default.json+++ b/crates/openhuman-app/capabilities/default.json@@ -12,6 +12,8 @@"core:window:allow-set-focus","core:window:allow-unminimize","core:window:allow-start-dragging",+ "core:window:allow-minimize",+ "core:window:allow-toggle-maximize","core:window:allow-set-always-on-top","core:event:default","deep-link:default",diff --git a/crates/openhuman-app/permissions/allow-core-process.toml b/crates/openhuman-app/permissions/allow-core-process.tomlindex e9a88b51ad..884a0ba1bb 100644--- a/crates/openhuman-app/permissions/allow-core-process.toml+++ b/crates/openhuman-app/permissions/allow-core-process.toml@@ -51,6 +51,9 @@ allow = [# Tauri capabilities and webviews keep the prior user's third-party# cookies."restart_app",+ # The Windows custom X and BootCheckGate's Quit action exit the host and+ # embedded core through this command. Registration alone is insufficient.+ "app_quit",# `get_active_user_id` reads `~/.openhuman/active_user.toml` so the# frontend can prime `userScopedStorage` from the Rust source of truth# BEFORE redux-persist hydrates — the prior `localStorage`-only seeddiff --git a/crates/openhuman-app/src/lib.rs b/crates/openhuman-app/src/lib.rsindex 0bc42dc71d..991b6288f8 100644--- a/crates/openhuman-app/src/lib.rs+++ b/crates/openhuman-app/src/lib.rs@@ -2342,6 +2342,24 @@ fn install_silent_x_error_handler() {fn install_silent_x_error_handler() {}pub fn run() {+ #[cfg(windows)]+ let context = {+ let mut context = tauri::generate_context!();+ if let Some(main) = context+ .config_mut()+ .app+ .windows+ .iter_mut()+ .find(|window| window.label == "main")+ {+ main.decorations = false;+ main.width = 800.0;+ main.height = 720.0;+ }+ context+ };+ #[cfg(not(windows))]+ let context = tauri::generate_context!();// Neutralise a broken inherited stderr *pipe* BEFORE any `eprintln!` can// fire. On Windows, when the GUI process inherits an stderr pipe whose// parent end later closes, the next stdlib stderr write fails with a@@ -3248,15 +3266,14 @@ pub fn run() {// `setup()` returns, which is why clamping here alone is// not enough.window_state::install_dpi_guard(&window);- // No saved geometry (first launch, or the save is stale /- // belongs to a detached monitor) → open filling the work area- // rather than the modest default size from `tauri.conf.json`.- // `center_main` stays as the fallback for the case where no- // monitor resolves at all.- if !window_state::restore_main(&window)- && !window_state::maximize_to_work_area(&window)- {- window_state::center_main(&window);+ // Windows starts at a compact near-square size. Other desktop+ // targets keep their existing work-area first-launch layout.+ if !window_state::restore_main(&window) {+ if cfg!(windows) {+ window_state::center_main(&window);+ } else if !window_state::maximize_to_work_area(&window) {+ window_state::center_main(&window);+ }}if !daemon_mode {if let Err(err) = window.show() {@@ -3487,7 +3504,7 @@ pub fn run() {loopback_oauth::stop_loopback_oauth_listener,claude_code::claude_code_login_launch])- .build(tauri::generate_context!())+ .build(context).expect("error while building tauri application").run(move |app_handle, event| match event {RunEvent::Ready => {@@ -3538,51 +3555,20 @@ pub fn run() {);}}- // Windows: full hide-to-tray.- //- // PR #1548 routed Windows X click into the same prevent_close +- // `window.hide()` branch as macOS, but on Windows the vendored- // CEF runtime's WindowMessage::Hide / Minimize / Restore- // (`tauri-runtime-cef/src/cef_impl.rs`) only operate on a- // `cef::Window` internal handle that does not correspond to the- // visible `Chrome_WidgetWin_1` top-level frame — `ShowWindow`- // calls against it are silent no-ops. We bypass the runtime- // entirely and walk the OS window list to issue SW_HIDE / SW_SHOW- // directly on the matching top-level frame (issue #1607).+ // Closing the Windows main window exits the desktop host and its+ // in-process core.#[cfg(target_os = "windows")]RunEvent::WindowEvent {label,event: WindowEvent::CloseRequested { api, .. },..} if label == "main" => {- log::info!(- "[window] close requested on main window — hiding to tray"- );+ log::info!("[window] close requested on main window — exiting app");api.prevent_close();- // Persist geometry now, while the window handle is still- // reachable. On Windows the hide below is a raw SW_HIDE on the- // OS frame, after which `get_webview_window("main")` returns- // `None` until the window is shown again (#1607). If the user- // then picks tray "Quit" while hidden, the ExitRequested save- // finds no window and nothing is persisted, so the next launch- // falls back to the default geometry (#4810). Saving here- // captures the last on-screen size/position before it becomes- // unreachable; ExitRequested still saves for the shown-window- // quit paths (`save_main` is best-effort and idempotent).if let Some(window) = app_handle.get_webview_window("main") {window_state::save_main(&window);}- // Hide the OS top-level Chrome_WidgetWin_1 frame via- // EnumWindows + SW_HIDE — full hide-to-tray as PR #1548- // intended. `window.hide()` and `window.minimize()` through- // the vendored CEF runtime are no-ops on Windows because- // `WebviewWindow::hwnd()` returns a cef::Window proxy handle- // rather than the visible top-level frame; we walk the OS- // window list directly instead (#1607). SW_HIDE on the host- // frame cascades to all child HWNDs (including the CEF- // browser surface), so no separate `webview.hide()` is- // needed and `show_main_window` only has to issue SW_SHOW.- set_main_window_hidden(true);+ app_handle.exit(0);}#[cfg(target_os = "macos")]RunEvent::Reopen { .. } => {diff --git a/docs/RELEASE-MANUAL-SMOKE.md b/docs/RELEASE-MANUAL-SMOKE.mdindex 479b64fdd0..d47fb5d482 100644--- a/docs/RELEASE-MANUAL-SMOKE.md+++ b/docs/RELEASE-MANUAL-SMOKE.md@@ -68,6 +68,7 @@ Applies to every release, all platforms.### Windows+- [ ] **Custom window frame and exit** — Launch with no saved window geometry. Expected: the window opens near 800 × 720 with compact rounded corners; the top-right controls minimize, maximize/restore, and close. Drag the window from the top strip on both the loading screen and main app. Closing exits the host and its embedded core (no lingering `OpenHuman.exe` or core listener).- [ ] **SmartScreen does not block install** — Run the installer from a fresh download. Expected: SmartScreen passes (signed binary). If `Windows protected your PC` appears, the EV signature is missing or the reputation has not built up — escalate before shipping.- [ ] **Installer creates Start Menu + Desktop shortcuts** — Defaults preserved. Expected: both shortcuts launch the app.- [ ] **Chat links preserve the desktop UI** — Click an HTTPS PR link in an assistant reply. Expected: the default browser opens the PR and OpenHuman stays on the same conversation. If the OS opener fails, the app must remain visible instead of navigating to the remote page. Check internal chat/settings navigation still works.diff --git a/scripts/run-dev-win.sh b/scripts/run-dev-win.shindex b7f8c92f9d..62fc9184e5 100644--- a/scripts/run-dev-win.sh+++ b/scripts/run-dev-win.sh@@ -7,7 +7,7 @@ APP_DIR="$REPO_ROOT/app"cd "$APP_DIR"# Load .env first so project env vars are available, but before we compute-# Windows-specific paths so tailored values (CEF_PATH, PATH, etc.) are set+# Windows-specific paths so tailored values (PATH, etc.) are set# after .env is applied and cannot be clobbered by it. A missing .env is# fine on a fresh clone, matching the macOS dev script.if [[ -f "$REPO_ROOT/.env" ]]; then@@ -275,11 +275,6 @@ echo "[run-dev-win] linker pinned: $msvc_link_win"# you get the "ninja: error: loading 'build.ninja'" mismatch.export CMAKE_GENERATOR=Ninja-# CEF runtime lives under LOCALAPPDATA on Windows.-# The Tauri/CEF setup stages it here; fall back to a default if unset.-CEF_PATH="${CEF_PATH:-$(cygpath -u "$LOCALAPPDATA")/tauri-cef}"-export CEF_PATH-to_unix_path() {if [[ -z "${1:-}" ]]; thenreturn 1@@ -484,6 +479,20 @@ fiexport PATH="$CARGO_DIR:$PATH"echo "[run-dev-win] cargo dir prepended to PATH: $CARGO_DIR"+# Cargo build scripts run for the Rust host, even when a different target is+# requested. Catch a host/MSVC mismatch before it surfaces as LNK4272 and a+# long list of unresolved Windows symbols.+RUST_HOST="$(rustc -vV | sed -n 's/^host: //p')"+MSVC_TARGET_ARCH="$(basename "$msvc_cl_dir")"+case "$RUST_HOST:$MSVC_TARGET_ARCH" in+ x86_64-pc-windows-msvc:x64|aarch64-pc-windows-msvc:arm64) ;;+ *)+ echo "[run-dev-win] Rust host $RUST_HOST does not match MSVC target $MSVC_TARGET_ARCH." >&2+ echo "[run-dev-win] Select a matching Rust toolchain or install matching MSVC C++ tools." >&2+ exit 1+ ;;+esac+PNPM_EXE="$(find_pnpm || true)"if [[ -z "$PNPM_EXE" ]]; thenecho "[run-dev-win] pnpm not found. Install pnpm and retry."@@ -523,15 +532,7 @@ if [[ -z "$NINJA_EXE" ]]; thenfiexport CMAKE_MAKE_PROGRAM="$NINJA_EXE"-CEF_RUNTIME_PATH="$(ls -d "$CEF_PATH"/*/cef_windows_x86_64 2>/dev/null | sort -Vr | head -n1 || true)"-if [[ -n "$CEF_RUNTIME_PATH" ]]; then- export CEF_RUNTIME_PATH-fi-PATH_PREFIX="/c/Program Files/CMake/bin:$(dirname "$NINJA_EXE")"-if [[ -n "${CEF_RUNTIME_PATH:-}" ]]; then- PATH_PREFIX="$PATH_PREFIX:$CEF_RUNTIME_PATH"-fi# Ensure the workspace node_modules/.bin is on PATH so pnpm's child# spawns (e.g. `pnpm tauri dev` → `tauri.CMD`) can resolve the shims.# Pnpm normally prepends `./node_modules/.bin` for script execution, but@@ -556,52 +557,7 @@ export PATH="$PATH_PREFIX:$PATH"# is used directly below. `core:stage` remains a no-op in this version."$PNPM_EXE" core:stage-# ─────────────────────────────────────────────────────────────────────────────-# Stage the CEF runtime next to the dev OpenHuman.exe.-#-# `cargo tauri build` (release) copies CEF into the bundle automatically, but-# `cargo tauri dev` doesn't — the dev .exe lands at <target>/debug/OpenHuman.exe-# alone, and Windows can't find libcef.dll. The .exe panics during boot with-# `cef::library_loader::LibraryLoader::new` errors (or just refuses to launch-# with "libcef.dll not found"). Without this step every fresh contributor-# session hits the wall.-#-# We stage by copying (not symlinking) so the script runs without admin /-# Developer-Mode privileges. `cp -ru` only copies entries newer than the-# destination, so subsequent dev runs are essentially free.-# ─────────────────────────────────────────────────────────────────────────────-if [[ -n "${CEF_RUNTIME_PATH:-}" && -f "$CEF_RUNTIME_PATH/libcef.dll" ]]; then- # The dev OpenHuman.exe is produced by the *Tauri shell* crate- # (crates/openhuman-app/Cargo.toml), not the root core crate. When- # CARGO_TARGET_DIR is set both workspaces share it; when unset, the- # Tauri shell builds into crates/openhuman-app/target while the root crate- # builds into target/. Stage CEF next to where OpenHuman.exe will- # actually live so Windows' DLL search order finds libcef.dll- # regardless of how the exe is launched (terminal, OAuth deep-link,- # double-click, etc).- if [[ -n "${CARGO_TARGET_DIR:-}" ]]; then- CEF_STAGE_DIR="$(to_unix_path "$CARGO_TARGET_DIR" 2>/dev/null || printf '%s' "$CARGO_TARGET_DIR")/debug"- else- CEF_STAGE_DIR="$REPO_ROOT/crates/openhuman-app/target/debug"- fi- mkdir -p "$CEF_STAGE_DIR"- if [[ ! -f "$CEF_STAGE_DIR/libcef.dll" \- || "$CEF_RUNTIME_PATH/libcef.dll" -nt "$CEF_STAGE_DIR/libcef.dll" ]]; then- echo "[run-dev-win] staging CEF runtime → $CEF_STAGE_DIR (first run only — copies ~270MB)"- cp -ru "$CEF_RUNTIME_PATH"/. "$CEF_STAGE_DIR/"- echo "[run-dev-win] CEF runtime staged"- else- echo "[run-dev-win] CEF runtime already staged at $CEF_STAGE_DIR (libcef.dll up to date)"- fi-else- echo "[run-dev-win] WARNING: CEF_RUNTIME_PATH not set or libcef.dll missing — the dev exe will fail to load" >&2- echo "[run-dev-win] expected: $CEF_PATH/<version>/cef_windows_x86_64/libcef.dll" >&2-fi--# Use the vendored tauri-cef CLI (via the pnpm tauri script) so the-# CEF runtime is correctly bundled. APPLE_SIGNING_IDENTITY is macOS-only-# and is intentionally omitted here.-#+# APPLE_SIGNING_IDENTITY is macOS-only and is intentionally omitted here.# OPENHUMAN_DEV_PORT lets parallel worktree dev sessions avoid the# hardcoded 1420 collision. Vite reads the same env var directly; the# tauri-cli inline override patches tauri.conf.json's `devUrl` so the@@ -680,6 +636,7 @@ if [[ -z "$NODE_EXE_UNIX" || ! -f "$NODE_EXE_UNIX" ]]; thenexit 1fiNODE_EXE_WIN="$(cygpath -w "$NODE_EXE_UNIX" 2>/dev/null || printf '%s' "$NODE_EXE_UNIX")"+APP_DIR_WIN="$(cygpath -w "$APP_DIR" 2>/dev/null || printf '%s' "$APP_DIR")"WRAPPER_DIR_UNIX="$(cygpath -u "${TEMP:-${TMP:-/tmp}}" 2>/dev/null || echo /tmp)/openhuman-dev"mkdir -p "$WRAPPER_DIR_UNIX"@@ -689,6 +646,7 @@ VITE_WRAPPER_UNIX="$WRAPPER_DIR_UNIX/run-vite.bat"# which fails inside cargo-tauri's cmd child (no node on PATH).{printf '@echo off\r\n'+ printf 'cd /d "%s"\r\n' "$APP_DIR_WIN"printf '"%s" "%s" %%*\r\n' "$NODE_EXE_WIN" "$VITE_JS_WIN"} > "$VITE_WRAPPER_UNIX"VITE_WRAPPER_WIN="$(cygpath -w "$VITE_WRAPPER_UNIX" 2>/dev/null || printf '%s' "$VITE_WRAPPER_UNIX")"