The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): expose the device-local tray preference in Appearance
brooklyn!5100e9c32877
diff --git a/apps/desktop/DESIGN.md b/apps/desktop/DESIGN.mdindex e85dc93f426..61e0514a2b3 100644--- a/apps/desktop/DESIGN.md+++ b/apps/desktop/DESIGN.md@@ -118,6 +118,17 @@ rows must not insert their full height before the outgoing stack can settle.No completion callback may clear the measurement of a newly arrived card.Reduced motion settles immediately without retaining empty clearance.+## Window background behavior++Settings → Appearance → Window layout offers **Minimize to tray**, off by default and+local to this desktop installation. When enabled, minimizing ordinary windows+hides them without stopping their work. Close, Alt+F4, and Cmd+Q keep their+normal behavior. The tray's **Show Hermes** restores hidden windows;+**Quit Hermes** keeps the ordinary active-work confirmation and teardown.+On macOS the tray lives in the menu bar; the Dock icon hides only when no normal+window remains visible and returns on restore. If the tray is unavailable,+ordinary minimize/close behavior is retained rather than hiding an unreachable app.+## Window glassGlass defaults to **29% Tint, Sidebar only** in both light and dark appearances.diff --git a/apps/desktop/src/app/settings/appearance-settings.tsx b/apps/desktop/src/app/settings/appearance-settings.tsxindex 6db9550da93..cab5769ad31 100644--- a/apps/desktop/src/app/settings/appearance-settings.tsx+++ b/apps/desktop/src/app/settings/appearance-settings.tsx@@ -68,6 +68,7 @@ import { appearanceSubpageForSetting, type AppearanceSubpageId } from './appearaimport { ChatFontSetting } from './chat-font-setting'import { MODE_OPTIONS } from './constants'import { setNested } from './helpers'+import { MinimizeToTraySetting } from './minimize-to-tray-setting'import { PetSettings } from './pet-settings'import { ListRow, SectionHeading, SettingsContent, ToggleRow } from './primitives'import { APPEARANCE_SETTING_IDS } from './settings-search'@@ -727,6 +728,12 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {/>)}+ {show('window-layout') && (+ <div id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.minimizeToTray)}>+ <MinimizeToTraySetting />+ </div>+ )}+{/* Linux has neither half of this setting (see TRANSLUCENCY_SUPPORTED),so the row is absent there rather than offering a dead lever. */}{show('window-layout') && TRANSLUCENCY_SUPPORTED && (diff --git a/apps/desktop/src/app/settings/appearance-subpages.ts b/apps/desktop/src/app/settings/appearance-subpages.tsindex c3b980fcc2f..23a22989444 100644--- a/apps/desktop/src/app/settings/appearance-subpages.ts+++ b/apps/desktop/src/app/settings/appearance-subpages.ts@@ -18,6 +18,7 @@ const SETTING_SUBPAGES: Readonly<Record<string, AppearanceSubpageId>> = {'appearance.hide-thread-timeline': 'chat-display','appearance.intro-splash': 'general','appearance.language': 'general',+ 'appearance.minimize-to-tray': 'window-layout','appearance.pet': 'pet','appearance.theme': 'theme','appearance.tool-view': 'chat-display',diff --git a/apps/desktop/src/app/settings/minimize-to-tray-setting.test.tsx b/apps/desktop/src/app/settings/minimize-to-tray-setting.test.tsxnew file mode 100644index 00000000000..74415381051--- /dev/null+++ b/apps/desktop/src/app/settings/minimize-to-tray-setting.test.tsx@@ -0,0 +1,93 @@+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'+import { afterEach, expect, test, vi } from 'vitest'++import { en } from '@/i18n/en'++import { MinimizeToTraySetting } from './minimize-to-tray-setting'++const errors = vi.hoisted(() => vi.fn())+vi.mock('@/store/notifications', () => ({ notifyError: errors }))+vi.mock('@/lib/haptics', () => ({ triggerHaptic: vi.fn() }))++const original = window.hermesDesktop+const c = en.settings.config+interface Status {+ enabled: boolean+ available: boolean+}++function bridge(initial: Status) {+ const listeners = new Set<(next: Status) => void>()++ const api = {+ get: vi.fn(async () => initial),+ set: vi.fn(async (enabled: boolean) => {+ const next = { enabled, available: enabled }+ listeners.forEach(listener => listener(next))++ return next+ }),+ onChanged: (listener: (next: Status) => void) => {+ listeners.add(listener)++ return () => {+ listeners.delete(listener)+ }+ }+ }++ window.hermesDesktop = { ...original, minimizeToTray: api }++ return { api, listeners }+}++afterEach(() => {+ cleanup()+ window.hermesDesktop = original+ vi.clearAllMocks()+})++test('native truth drives both mounted settings rows and survives remount without renderer writes', async () => {+ const { api, listeners } = bridge({ enabled: false, available: false })+ const view = render(+ <>+ <MinimizeToTraySetting />+ <MinimizeToTraySetting />+ </>+ )+ const toggles = await screen.findAllByRole('switch', { name: c.minimizeToTrayTitle })+ await waitFor(() => expect(toggles.every(toggle => !toggle.hasAttribute('disabled'))).toBe(true))+ expect(api.set).not.toHaveBeenCalled()+ fireEvent.click(toggles[0])+ await waitFor(() => expect(toggles.every(toggle => toggle.getAttribute('aria-checked') === 'true')).toBe(true))+ expect(api.set).toHaveBeenCalledWith(true)+ act(() => listeners.forEach(listener => listener({ enabled: true, available: false })))+ expect(screen.getAllByText(c.minimizeToTrayUnavailable)).toHaveLength(2)+ view.unmount()+ expect(listeners.size).toBe(0)+ api.get.mockResolvedValue({ enabled: true, available: true })+ render(<MinimizeToTraySetting />)+ await waitFor(() => expect(screen.getByRole('switch').getAttribute('aria-checked')).toBe('true'))+ expect(api.set).toHaveBeenCalledTimes(1)+})++test('failed writes roll back visibly, and an older initial read cannot overwrite a peer update', async () => {+ const { api, listeners } = bridge({ enabled: false, available: false })+ let finishRead!: (status: Status) => void+ api.get.mockImplementation(+ () =>+ new Promise(resolve => {+ finishRead = resolve+ })+ )+ render(<MinimizeToTraySetting />)+ act(() => listeners.forEach(listener => listener({ enabled: true, available: true })))+ await act(async () => finishRead({ enabled: false, available: false }))+ const toggle = screen.getByRole('switch')+ expect(toggle.getAttribute('aria-checked')).toBe('true')+ const failure = new Error('Disk write failed')+ api.set.mockRejectedValue(failure)+ fireEvent.click(toggle)+ await waitFor(() => expect(errors).toHaveBeenCalledWith(failure, c.autosaveFailed))+ expect(toggle.getAttribute('aria-checked')).toBe('true')+})diff --git a/apps/desktop/src/app/settings/minimize-to-tray-setting.tsx b/apps/desktop/src/app/settings/minimize-to-tray-setting.tsxnew file mode 100644index 00000000000..bc4fb882fdd--- /dev/null+++ b/apps/desktop/src/app/settings/minimize-to-tray-setting.tsx@@ -0,0 +1,102 @@+import { useCallback, useEffect, useRef, useState } from 'react'++import { Button } from '@/components/ui/button'+import { useI18n } from '@/i18n'+import { notifyError } from '@/store/notifications'++import { ToggleRow } from './primitives'++export function MinimizeToTraySetting() {+ const { t } = useI18n()+ const c = t.settings.config+ const bridge = window.hermesDesktop?.minimizeToTray+ const [status, setStatus] = useState<{ enabled: boolean; available: boolean } | null>(null)+ const [saving, setSaving] = useState(false)+ const [loadFailed, setLoadFailed] = useState(false)+ const revision = useRef(0)++ const load = useCallback(async () => {+ if (!bridge) {+ return+ }+ const version = ++revision.current+ setLoadFailed(false)++ try {+ const next = await bridge.get()++ if (revision.current === version) {+ setStatus(next)+ }+ } catch (error) {+ if (revision.current === version) {+ setLoadFailed(true)+ notifyError(error, c.failedLoad)+ }+ }+ }, [bridge, c.failedLoad])++ useEffect(() => {+ if (!bridge) {+ return+ }++ const unsubscribe = bridge.onChanged(next => {+ revision.current+++ setStatus(next)+ setLoadFailed(false)+ })++ void load()++ return () => {+ revision.current+++ unsubscribe()+ }+ }, [bridge, load])++ if (!bridge) {+ return null+ }++ const save = async (enabled: boolean) => {+ const previous = status+ const version = ++revision.current+ setSaving(true)+ setStatus({ enabled, available: status?.available ?? false })++ try {+ const next = await bridge.set(enabled)++ if (revision.current === version) {+ setStatus(next)+ }+ } catch (error) {+ if (revision.current === version) {+ setStatus(previous)+ }+ notifyError(error, c.autosaveFailed)+ } finally {+ setSaving(false)+ }+ }++ return (+ <>+ <ToggleRow+ checked={status?.enabled ?? false}+ description={+ status?.enabled && !status.available && !saving ? c.minimizeToTrayUnavailable : c.minimizeToTrayDesc+ }+ disabled={!status || saving}+ label={c.minimizeToTrayTitle}+ onChange={enabled => void save(enabled)}+ />+ {loadFailed && (+ <Button onClick={() => void load()} size="sm" variant="secondary">+ {t.settings.screenshot.retry}+ </Button>+ )}+ </>+ )+}diff --git a/apps/desktop/src/app/settings/settings-search.ts b/apps/desktop/src/app/settings/settings-search.tsindex c3b493572b4..e399fe7d429 100644--- a/apps/desktop/src/app/settings/settings-search.ts+++ b/apps/desktop/src/app/settings/settings-search.ts@@ -19,6 +19,7 @@ export const APPEARANCE_SETTING_IDS = {hideThreadTimeline: 'appearance.hide-thread-timeline',introSplash: 'appearance.intro-splash',language: 'appearance.language',+ minimizeToTray: 'appearance.minimize-to-tray',theme: 'appearance.theme',toolView: 'appearance.tool-view',translucency: 'appearance.translucency',diff --git a/apps/desktop/src/app/settings/use-settings-search.ts b/apps/desktop/src/app/settings/use-settings-search.tsindex 0ef1c8b2c7f..a33a93b990f 100644--- a/apps/desktop/src/app/settings/use-settings-search.ts+++ b/apps/desktop/src/app/settings/use-settings-search.ts@@ -125,6 +125,19 @@ export function useSettingsSearchCatalog(enabled: boolean) {const appearance = t.settings.appearanceconst appearanceEntries: SettingsSearchEntry[] = [+ ...(window.hermesDesktop?.minimizeToTray+ ? [+ {+ context: appearanceContext,+ description: t.settings.config.minimizeToTrayDesc,+ icon: Monitor,+ id: `setting:${APPEARANCE_SETTING_IDS.minimizeToTray}`,+ keywords: ['tray', 'background', 'minimize', 'dock', 'taskbar', 'menu bar'],+ label: t.settings.config.minimizeToTrayTitle,+ target: { view: 'config:appearance' as const, setting: APPEARANCE_SETTING_IDS.minimizeToTray }+ }+ ]+ : []),{context: appearanceContext,description: t.language.description,diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex 3187d4cd011..5ac15e2389a 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -879,6 +879,11 @@ export const ar = defineLocale({daysAgo: count => `قبل ${count} يوم`},config: {+ minimizeToTrayTitle: 'التصغير إلى علبة النظام',+ minimizeToTrayDesc:+ 'إخفاء النوافذ المصغّرة في علبة النظام (شريط القوائم على macOS) مع استمرار Hermes في العمل. يظل سلوك الإغلاق وAlt+F4 وCmd+Q كما هو. معطّل افتراضيًا ويُطبّق على هذا الجهاز فقط.',+ minimizeToTrayUnavailable:+ 'علبة النظام غير متاحة. ستُصغّر النوافذ وتُغلق كالمعتاد. أوقف هذا الخيار ثم فعّله لإعادة المحاولة.',none: 'لا شيء',noneParen: '(لا شيء)',notSet: 'غير مضبوط',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 3221852be72..a3d133e401b 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -996,6 +996,11 @@ export const en: Translations = {daysAgo: count => `${count} days ago`},config: {+ minimizeToTrayTitle: 'Minimize to tray',+ minimizeToTrayDesc:+ 'Hide minimized windows in the system tray (menu bar on macOS) while Hermes keeps running. Close, Alt+F4, and Cmd+Q keep their normal behavior. Off by default; applies only to this device.',+ minimizeToTrayUnavailable:+ 'The system tray is unavailable. Windows will minimize and close normally. Turn this off and on to retry.',none: 'None',noneParen: '(none)',builtinOnly: 'Built-in only',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 0e51f012c39..cd1ed20c467 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -960,6 +960,11 @@ export const ja = defineLocale({daysAgo: count => `${count} 日前`},config: {+ minimizeToTrayTitle: 'トレイに最小化',+ minimizeToTrayDesc:+ '最小化したウィンドウをシステムトレイ(macOS ではメニューバー)に隠し、Hermes を実行し続けます。閉じる、Alt+F4、Cmd+Q の動作は変わりません。初期設定はオフで、このデバイスにのみ適用されます。',+ minimizeToTrayUnavailable:+ 'システムトレイを利用できないため、通常どおり最小化・終了します。再試行するには一度オフにしてからオンにしてください。',none: 'なし',noneParen: '(なし)',builtinOnly: '内蔵のみ',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex d72e2dca58e..6c9b2f83889 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -1045,6 +1045,11 @@ export const ru = defineLocale({daysAgo: count => `${count} ${RU_NOUN(count, 'день', 'дня', 'дней')} назад`},config: {+ minimizeToTrayTitle: 'Сворачивать в трей',+ minimizeToTrayDesc:+ 'Скрывает свёрнутые окна в системном трее (строке меню macOS), пока Hermes продолжает работать. Закрытие, Alt+F4 и Cmd+Q работают как обычно. По умолчанию выключено; действует только на этом устройстве.',+ minimizeToTrayUnavailable:+ 'Системный трей недоступен. Окна будут сворачиваться и закрываться как обычно. Выключите и снова включите настройку, чтобы повторить попытку.',none: 'Нет',noneParen: '(нет)',builtinOnly: 'Только встроенные',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 798229d1a11..11594e4edf6 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -815,6 +815,9 @@ export interface Translations {daysAgo: (count: number) => string}config: {+ minimizeToTrayTitle: string+ minimizeToTrayDesc: string+ minimizeToTrayUnavailable: stringnone: stringnoneParen: stringbuiltinOnly: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 5a8c53d41d6..104c82f3b26 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -998,6 +998,10 @@ export const zhHant = defineLocale({daysAgo: count => `${count} 天前`},config: {+ minimizeToTrayTitle: '最小化至系統匣',+ minimizeToTrayDesc:+ '將最小化的視窗隱藏至系統匣(macOS 上為選單列),讓 Hermes 繼續執行。關閉視窗、Alt+F4 和 Cmd+Q 的行為不變。預設關閉,僅適用於此裝置。',+ minimizeToTrayUnavailable: '系統匣無法使用。視窗將正常最小化和關閉。關閉此選項後重新開啟即可重試。',none: '無',noneParen: '(無)',builtinOnly: '僅內建',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 5316dec4bbf..9f4437f7bbd 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -1208,6 +1208,10 @@ export const zh = defineLocale({daysAgo: count => `${count} 天前`},config: {+ minimizeToTrayTitle: '最小化到托盘',+ minimizeToTrayDesc:+ '将最小化的窗口隐藏到系统托盘(macOS 上为菜单栏),Hermes 继续运行。关闭窗口、Alt+F4 和 Cmd+Q 的行为不变。默认关闭,仅适用于此设备。',+ minimizeToTrayUnavailable: '系统托盘不可用。窗口将正常最小化和关闭。关闭此选项后重新开启即可重试。',none: '无',noneParen: '(无)',builtinOnly: '仅内置',diff --git a/website/docs/user-guide/desktop.md b/website/docs/user-guide/desktop.mdindex 07f3e08ac0b..f5169b17d12 100644--- a/website/docs/user-guide/desktop.md+++ b/website/docs/user-guide/desktop.md@@ -128,6 +128,14 @@ The app is built for working on several things at once:- **Multiple windows** — **Cmd/Ctrl+Shift+N** opens a new window, and any session can be popped out via its context menu (**New window**) or from the command palette. A popped-out window renders that single chat without the global sidebar — handy for parking a long-running session on another monitor. Live agent output streams into every window showing the session.- **Panes** — **Cmd/Ctrl+B** toggles the left sidebar, **Cmd/Ctrl+J** the right one, and **Cmd/Ctrl+\\** swaps which side the sidebars sit on.+#### Minimize to tray++Enable **Settings → Appearance → Window layout → Minimize to tray** to hide minimized windows from the taskbar or Dock while their sessions keep running. The setting is off by default and applies only to this device.++Use **Show Hermes** in the system tray (the menu bar on macOS) to restore the windows. **Quit Hermes** still uses the normal active-work confirmation. Closing a window, **Alt+F4**, and **Cmd+Q** keep their existing behavior; this setting does not turn Close into hide-to-tray.++On macOS, the Dock icon hides only when no ordinary Hermes window remains visible. On Linux, a registered StatusNotifier tray host is required; desktops without one keep normal minimize behavior. If the host disappears, hidden windows are restored.+### TerminalA real terminal lives in the right sidebar, next to the file browser: