Skip to content

The agent that grows with you

feat(desktop): let Appearance choose left or right for titlebar app actions

abundantbeing837e4b094286
diff --git a/apps/desktop/src/app/contrib/wiring.tsx b/apps/desktop/src/app/contrib/wiring.tsx
index 9a043a1c51c..4b4c36594bb 100644
--- a/apps/desktop/src/app/contrib/wiring.tsx
+++ b/apps/desktop/src/app/contrib/wiring.tsx
@@ -52,6 +52,7 @@ import { requestGatewayForProfile } from '@/store/gateway'
import { $pinnedSessionIds, pinSession, restoreWorktree, unpinSession } from '@/store/layout'
import { notifyError } from '@/store/notifications'
import { $previewTarget } from '@/store/preview'
+import { $titlebarAppActionsSide, titlebarAppActionsClusterCounts } from '@/store/titlebar-app-actions'
import {
$activeGatewayProfile,
$freshSessionRequest,
@@ -1200,14 +1201,15 @@ export function ContribWiring({ children }: { children: ReactNode }) {
}
const titlebarToolsRight = titlebarToolsRightCss(nativeOverlayWidth, titlebarChrome)
- // Right cluster: settings, layout, HUD, flip, right-sidebar toggle.
- const SYSTEM_TOOL_COUNT = 5
+ const appActionsSide = useStore($titlebarAppActionsSide)
const paneToolCount = rightTitlebarTools.filter(tool => !tool.hidden).length
- const systemToolsWidth = titlebarToolsWidthCss(SYSTEM_TOOL_COUNT)
+ const leftExtraCount = leftTitlebarTools.filter(tool => !tool.hidden).length
+ const clusters = titlebarAppActionsClusterCounts(appActionsSide, leftExtraCount, 0)
+ const systemToolsWidth = titlebarToolsWidthCss(clusters.right)
const titlebarToolsWidth =
paneToolCount > 0 ? `calc(${systemToolsWidth} + ${titlebarToolsWidthCss(paneToolCount)})` : systemToolsWidth
- const leftToolsWidth = titlebarToolsWidthCss(1 + leftTitlebarTools.filter(tool => !tool.hidden).length)
+ const leftToolsWidth = titlebarToolsWidthCss(clusters.left)
return (
<ContribWiringContext.Provider value={api}>
diff --git a/apps/desktop/src/app/settings/appearance-settings.tsx b/apps/desktop/src/app/settings/appearance-settings.tsx
index f0145cc7c0c..d8019724ce2 100644
--- a/apps/desktop/src/app/settings/appearance-settings.tsx
+++ b/apps/desktop/src/app/settings/appearance-settings.tsx
@@ -24,6 +24,11 @@ import { $reactionsEnabled, setReactionsEnabled } from '@/store/reactions-enable
import { $reasoningCollapsedByDefault, setReasoningCollapsedByDefault } from '@/store/reasoning-disclosure'
import { $sessionListDensity, type SessionListDensity, setSessionListDensity } from '@/store/session-list-density'
import { $tabStripDefault, setTabStripDefault, type TabStripDefault } from '@/store/tabstrip-prefs'
+import {
+ $titlebarAppActionsSide,
+ setTitlebarAppActionsSide,
+ type TitlebarAppActionsSide
+} from '@/store/titlebar-app-actions'
import { $spentTipCount, $tipsEnabled, resetTips, setTipsEnabled } from '@/store/tips'
import { $toolViewMode, setToolViewMode } from '@/store/tool-view'
import { $toursEnabled, setToursEnabled } from '@/store/tours'
@@ -397,6 +402,7 @@ export function AppearanceSettings() {
const reasoningCollapsedByDefault = useStore($reasoningCollapsedByDefault)
const sessionListDensity = useStore($sessionListDensity)
const tabStripDefault = useStore($tabStripDefault)
+ const titlebarAppActionsSide = useStore($titlebarAppActionsSide)
const zoomPercent = useStore($zoomPercent)
const embedMode = useStore($embedMode)
const embedAllowed = useStore($embedAllowed)
@@ -486,6 +492,11 @@ export function AppearanceSettings() {
{ id: 'never', label: a.tabStripNever }
] as const satisfies readonly { id: TabStripDefault; label: string }[]
+ const appActionsOptions = [
+ { id: 'right', label: a.appActionsRight },
+ { id: 'left', label: a.appActionsLeft }
+ ] as const satisfies readonly { id: TitlebarAppActionsSide; label: string }[]
+
const embedOptions = [
{ id: 'ask', label: a.embedsAsk },
{ id: 'always', label: a.embedsAlways },
@@ -661,6 +672,22 @@ export function AppearanceSettings() {
title={a.tabStripTitle}
/>
+ <ListRow
+ action={
+ <SegmentedControl
+ onChange={id => {
+ triggerHaptic('selection')
+ setTitlebarAppActionsSide(id)
+ }}
+ options={appActionsOptions}
+ value={titlebarAppActionsSide}
+ />
+ }
+ description={a.appActionsDesc}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.appActions)}
+ title={a.appActionsTitle}
+ />
+
{/* Linux has neither half of this setting (see TRANSLUCENCY_SUPPORTED),
so the row is absent there rather than offering a dead lever. */}
{TRANSLUCENCY_SUPPORTED && (
diff --git a/apps/desktop/src/app/settings/settings-search.ts b/apps/desktop/src/app/settings/settings-search.ts
index 84e9f924c83..dc827865cd5 100644
--- a/apps/desktop/src/app/settings/settings-search.ts
+++ b/apps/desktop/src/app/settings/settings-search.ts
@@ -11,6 +11,7 @@ import type { DesktopConfigSection, SettingsView } from './types'
export type CredentialSettingsView = 'settings' | 'tools'
export const APPEARANCE_SETTING_IDS = {
+ appActions: 'appearance.app-actions',
backdrop: 'appearance.backdrop',
embeds: 'appearance.embeds',
introSplash: 'appearance.intro-splash',
diff --git a/apps/desktop/src/app/settings/use-settings-search.ts b/apps/desktop/src/app/settings/use-settings-search.ts
index 6bcaf1bbaca..99db78e05b3 100644
--- a/apps/desktop/src/app/settings/use-settings-search.ts
+++ b/apps/desktop/src/app/settings/use-settings-search.ts
@@ -198,6 +198,15 @@ export function useSettingsSearchCatalog(enabled: boolean) {
label: appearance.toolViewTitle,
target: { setting: APPEARANCE_SETTING_IDS.toolView, view: 'config:appearance' }
},
+ {
+ context: appearanceContext,
+ description: appearance.appActionsDesc,
+ icon: Palette,
+ id: `setting:${APPEARANCE_SETTING_IDS.appActions}`,
+ keywords: ['titlebar', 'settings gear', 'layout', 'HUD', 'left', 'right', 'tabs'],
+ label: appearance.appActionsTitle,
+ target: { setting: APPEARANCE_SETTING_IDS.appActions, view: 'config:appearance' }
+ },
{
context: appearanceContext,
description: appearance.embedsDesc,
diff --git a/apps/desktop/src/app/shell/titlebar-controls.test.tsx b/apps/desktop/src/app/shell/titlebar-controls.test.tsx
index df89595f310..6dbda5030d2 100644
--- a/apps/desktop/src/app/shell/titlebar-controls.test.tsx
+++ b/apps/desktop/src/app/shell/titlebar-controls.test.tsx
@@ -5,6 +5,7 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { registry } from '@/contrib/registry'
import { I18nProvider } from '@/i18n'
+import { setTitlebarAppActionsSide } from '@/store/titlebar-app-actions'
import { ROUTES_AREA } from '../routes'
@@ -134,7 +135,12 @@ describe('TitlebarControls fixed clusters', () => {
})
describe('titlebar app-action cluster', () => {
- it('keeps settings, layout, and HUD on the right so the left titlebar stays free for tabs', () => {
+ afterEach(() => {
+ setTitlebarAppActionsSide('right')
+ cleanup()
+ })
+
+ it('defaults settings, layout, and HUD to the right so the left titlebar stays free for tabs', () => {
renderControls('/')
const left = screen.getByLabelText('Window controls')
@@ -149,4 +155,17 @@ describe('titlebar app-action cluster', () => {
expect(within(left).queryByLabelText('HUD mode')).toBeNull()
expect(within(left).getByLabelText(/Hide sidebar|Show sidebar/)).toBeTruthy()
})
+
+ it('moves settings, layout, and HUD to the left when the appearance setting says left', () => {
+ setTitlebarAppActionsSide('left')
+ renderControls('/')
+
+ const left = screen.getByLabelText('Window controls')
+ const right = screen.getByLabelText('App controls')
+
+ expect(within(left).getByLabelText('Open settings')).toBeTruthy()
+ expect(within(left).getByLabelText('Layout editor')).toBeTruthy()
+ expect(within(left).getByLabelText('HUD mode')).toBeTruthy()
+ expect(within(right).queryByLabelText('Open settings')).toBeNull()
+ })
})
diff --git a/apps/desktop/src/app/shell/titlebar-controls.tsx b/apps/desktop/src/app/shell/titlebar-controls.tsx
index 416ae7c674e..cd3d74e52ce 100644
--- a/apps/desktop/src/app/shell/titlebar-controls.tsx
+++ b/apps/desktop/src/app/shell/titlebar-controls.tsx
@@ -25,6 +25,7 @@ import {
toggleSidebarOpen
} from '@/store/layout'
import { $unreadSessionCount } from '@/store/session-dot-state'
+import { $titlebarAppActionsSide } from '@/store/titlebar-app-actions'
import { appViewForPath, hidesFixedTitlebarClusters, isOverlayView } from '../routes'
@@ -139,6 +140,7 @@ export function TitlebarControls({ leftTools = [], tools = [], onOpenSettings }:
const panesFlipped = useStore($panesFlipped)
const sidebarOpen = useStore($sidebarOpen)
const unreadCount = useStore($unreadSessionCount)
+ const appActionsSide = useStore($titlebarAppActionsSide)
const unreadBadge = unreadCount > 0 ? unreadCount : undefined
const unreadHint = unreadBadge ? ` · ${t.titlebar.unreadSessions(unreadBadge)}` : ''
@@ -286,8 +288,10 @@ export function TitlebarControls({ leftTools = [], tools = [], onOpenSettings }:
)
}
- const visibleLeftTools = [sidebarTool, ...leftTools].filter(tool => !tool.hidden)
- const visibleSystemTools = systemTools.filter(tool => !tool.hidden)
+ const visibleLeftTools = (
+ appActionsSide === 'left' ? [sidebarTool, ...systemTools, ...leftTools] : [sidebarTool, ...leftTools]
+ ).filter(tool => !tool.hidden)
+ const visibleSystemTools = appActionsSide === 'right' ? systemTools.filter(tool => !tool.hidden) : []
const visiblePaneTools = tools.filter(tool => !tool.hidden)
return (
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 4c0aa9f6e9b..6a71f41b911 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -705,6 +705,10 @@ export const en: Translations = {
tabStripAuto: 'Auto',
tabStripAlways: 'Always',
tabStripNever: 'Never',
+ appActionsTitle: 'App Actions',
+ appActionsDesc: 'Where Settings, Layout, and HUD sit in the titlebar. Right leaves room for tabs on the left.',
+ appActionsLeft: 'Left',
+ appActionsRight: 'Right',
terminalFontTitle: 'Terminal Font',
terminalFontDesc:
'Choose an installed font for Desktop terminals. Nerd Fonts render Powerlevel10k and shell icons; leave blank to use bundled JetBrains Mono.',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index df727947cf2..9ec5e46989f 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -499,6 +499,10 @@ export const ja = defineLocale({
tabStripAuto: '自動',
tabStripAlways: '常に表示',
tabStripNever: '表示しない',
+ appActionsTitle: 'アプリ操作',
+ appActionsDesc: '設定・レイアウト・HUD をタイトルバーの左右どちらに置くか。右にするとタブ用のスペースが左に残ります。',
+ appActionsLeft: '左',
+ appActionsRight: '右',
terminalFontTitle: 'ターミナルフォント',
terminalFontDesc:
'Desktop のターミナルで使用するインストール済みフォントを選びます。Nerd Font は Powerlevel10k とシェルアイコンを表示できます。空欄では内蔵の JetBrains Mono を使用します。',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index bb90986541c..594f74ddfb8 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -568,6 +568,10 @@ export const ru = defineLocale({
tabStripAuto: 'Авто',
tabStripAlways: 'Всегда',
tabStripNever: 'Никогда',
+ appActionsTitle: 'Действия приложения',
+ appActionsDesc: 'Где в заголовке окна сидят Настройки, Макет и HUD. Справа оставляют место для вкладок слева.',
+ appActionsLeft: 'Слева',
+ appActionsRight: 'Справа',
terminalFontTitle: 'Шрифт терминала',
terminalFontDesc:
'Выберите установленный шрифт для терминалов приложения. Nerd Fonts отображают Powerlevel10k и иконки оболочки; оставьте пустым, чтобы использовать встроенный JetBrains Mono.',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 69771dc20ee..e8aed0763e1 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -756,6 +756,10 @@ export interface Translations {
tabStripAuto: string
tabStripAlways: string
tabStripNever: string
+ appActionsTitle: string
+ appActionsDesc: string
+ appActionsLeft: string
+ appActionsRight: string
terminalFontTitle: string
terminalFontDesc: string
terminalFontPlaceholder: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index da3416b238a..741de25d6c9 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -484,6 +484,10 @@ export const zhHant = defineLocale({
tabStripAuto: '自動',
tabStripAlways: '一律',
tabStripNever: '永不',
+ appActionsTitle: '應用操作',
+ appActionsDesc: '設定、版面與 HUD 放在標題列左側或右側。選右側可把左側留給分頁。',
+ appActionsLeft: '左側',
+ appActionsRight: '右側',
terminalFontTitle: '終端機字型',
terminalFontDesc:
'選擇已安裝的字型用於桌面端終端機。Nerd Font 可正確顯示 Powerlevel10k 與 Shell 圖示;留空則使用內建的 JetBrains Mono。',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index b6bf7ae990a..be5b3d64959 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -686,6 +686,10 @@ export const zh: Translations = {
tabStripAuto: '自动',
tabStripAlways: '始终',
tabStripNever: '从不',
+ appActionsTitle: '应用操作',
+ appActionsDesc: '设置、布局和 HUD 放在标题栏左侧还是右侧。选右侧可给标签留出左边空间。',
+ appActionsLeft: '左侧',
+ appActionsRight: '右侧',
terminalFontTitle: '终端字体',
terminalFontDesc:
'选择已安装的字体用于桌面端终端。Nerd Font 可正确显示 Powerlevel10k 和 Shell 图标;留空则使用内置的 JetBrains Mono。',
diff --git a/apps/desktop/src/store/titlebar-app-actions.test.ts b/apps/desktop/src/store/titlebar-app-actions.test.ts
new file mode 100644
index 00000000000..0ebf92c7887
--- /dev/null
+++ b/apps/desktop/src/store/titlebar-app-actions.test.ts
@@ -0,0 +1,37 @@
+import { beforeEach, describe, expect, it } from 'vitest'
+
+import {
+ $titlebarAppActionsSide,
+ setTitlebarAppActionsSide,
+ TITLEBAR_APP_ACTIONS_DEFAULT,
+ titlebarAppActionsClusterCounts
+} from './titlebar-app-actions'
+
+describe('titlebarAppActionsClusterCounts', () => {
+ it('puts the three app actions on the right by default', () => {
+ expect(titlebarAppActionsClusterCounts('right')).toEqual({ left: 1, right: 5 })
+ expect(titlebarAppActionsClusterCounts('left')).toEqual({ left: 4, right: 2 })
+ })
+
+ it('adds extras to the cluster they belong to', () => {
+ expect(titlebarAppActionsClusterCounts('right', 1, 2)).toEqual({ left: 2, right: 7 })
+ expect(titlebarAppActionsClusterCounts('left', 1, 2)).toEqual({ left: 5, right: 4 })
+ })
+})
+
+describe('$titlebarAppActionsSide', () => {
+ beforeEach(() => {
+ window.localStorage.clear()
+ setTitlebarAppActionsSide(TITLEBAR_APP_ACTIONS_DEFAULT)
+ })
+
+ it('defaults to right', () => {
+ expect($titlebarAppActionsSide.get()).toBe('right')
+ })
+
+ it('persists left', () => {
+ setTitlebarAppActionsSide('left')
+ expect($titlebarAppActionsSide.get()).toBe('left')
+ expect(window.localStorage.getItem('hermes.desktop.titlebarAppActions')).toBe('left')
+ })
+})
diff --git a/apps/desktop/src/store/titlebar-app-actions.ts b/apps/desktop/src/store/titlebar-app-actions.ts
new file mode 100644
index 00000000000..a787549092d
--- /dev/null
+++ b/apps/desktop/src/store/titlebar-app-actions.ts
@@ -0,0 +1,41 @@
+import { type Codec, persistentAtom } from '@/lib/persisted'
+
+export type TitlebarAppActionsSide = 'left' | 'right'
+
+const STORAGE_KEY = 'hermes.desktop.titlebarAppActions'
+
+/** Right is the original titlebar: Settings / Layout / HUD stay off the tab strip. */
+export const TITLEBAR_APP_ACTIONS_DEFAULT: TitlebarAppActionsSide = 'right'
+
+const codec: Codec<TitlebarAppActionsSide> = {
+ decode: raw => (raw === 'left' || raw === 'right' ? raw : TITLEBAR_APP_ACTIONS_DEFAULT),
+ encode: value => value
+}
+
+export const $titlebarAppActionsSide = persistentAtom<TitlebarAppActionsSide>(
+ STORAGE_KEY,
+ TITLEBAR_APP_ACTIONS_DEFAULT,
+ codec
+)
+
+export function setTitlebarAppActionsSide(side: TitlebarAppActionsSide) {
+ $titlebarAppActionsSide.set(side)
+}
+
+/** Button counts for the two titlebar clusters. Sidebar is always left; flip and
+ * the right-sidebar toggle are always right; the three app actions follow `side`. */
+export function titlebarAppActionsClusterCounts(
+ side: TitlebarAppActionsSide,
+ leftExtras = 0,
+ rightExtras = 0
+): { left: number; right: number } {
+ const sidebar = 1
+ const appActions = 3
+ const rightFixed = 2
+
+ if (side === 'left') {
+ return { left: sidebar + appActions + leftExtras, right: rightFixed + rightExtras }
+ }
+
+ return { left: sidebar + leftExtras, right: appActions + rightFixed + rightExtras }
+}