Skip to content

The agent that grows with you

fix(desktop): show platform layout modifier

273-B_L0f61fb52f9464
diff --git a/apps/desktop/src/app/shell/titlebar-controls.tsx b/apps/desktop/src/app/shell/titlebar-controls.tsx
index b0b6b832ca8..72e297d9ac3 100644
--- a/apps/desktop/src/app/shell/titlebar-controls.tsx
+++ b/apps/desktop/src/app/shell/titlebar-controls.tsx
@@ -9,6 +9,7 @@ import { Button } from '@/components/ui/button'
import { Tip, TipKeybindLabel } from '@/components/ui/tooltip'
import { useI18n } from '@/i18n'
import { triggerHaptic } from '@/lib/haptics'
+import { formatModifierToken } from '@/lib/keybinds/combo'
import { cn } from '@/lib/utils'
import { $hapticsMuted, toggleHapticsMuted } from '@/store/haptics'
import { toggleHud } from '@/store/hud'
@@ -185,7 +186,7 @@ export function TitlebarControls({ leftTools = [], tools = [], onOpenSettings }:
triggerHaptic('open')
toggleLayoutEditMode()
},
- title: t.titlebar.layoutEditorTitle
+ title: t.titlebar.layoutEditorTitle(formatModifierToken('mod'))
},
{
// No `title`: TitlebarToolButton passes `title` to TipKeybindLabel as a
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index ce16fc742e2..c53d0249987 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -176,7 +176,7 @@ export const ar = defineLocale({
enterHud: 'وضع HUD',
exitHud: 'إنهاء وضع HUD',
layoutEditor: 'محرر التخطيط',
- layoutEditorTitle: 'محرر التخطيط — انقر مع ⌘ لإعادة ضبط التخطيط'
+ layoutEditorTitle: modifier => `محرر التخطيط — انقر مع ${modifier} لإعادة ضبط التخطيط`
},
keybinds: {
title: 'اختصارات لوحة المفاتيح',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 38f8db2de87..63c49820d07 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -206,7 +206,7 @@ export const en: Translations = {
enterHud: 'HUD mode',
exitHud: 'Exit HUD mode',
layoutEditor: 'Layout editor',
- layoutEditorTitle: 'Layout editor — ⌘-click resets the layout'
+ layoutEditorTitle: mod => `Layout editor — ${mod}-click resets the layout`
},
keybinds: {
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 88ffd56000d..dcb27056c22 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -248,7 +248,7 @@ export interface Translations {
enterHud: string
exitHud: string
layoutEditor: string
- layoutEditorTitle: string
+ layoutEditorTitle: (modifier: string) => string
}
keybinds: {
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 51b20a9d386..9b8955c123f 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -201,7 +201,7 @@ export const zh: Translations = {
enterHud: 'HUD 模式',
exitHud: '退出 HUD 模式',
layoutEditor: '布局编辑器',
- layoutEditorTitle: '布局编辑器 — ⌘ 点击重置布局'
+ layoutEditorTitle: mod => `布局编辑器 — ${mod} 点击重置布局`
},
keybinds: {
diff --git a/apps/desktop/src/lib/keybinds/combo.test.ts b/apps/desktop/src/lib/keybinds/combo.test.ts
index 25968b756e0..0e30d925347 100644
--- a/apps/desktop/src/lib/keybinds/combo.test.ts
+++ b/apps/desktop/src/lib/keybinds/combo.test.ts
@@ -111,19 +111,21 @@ describe('canonicalizeCombo', () => {
describe('formatCombo — honest Control labels', () => {
it('renders the Control glyph on macOS', async () => {
- const { formatCombo } = await loadCombo('MacIntel')
+ const { formatCombo, formatModifierToken } = await loadCombo('MacIntel')
expect(formatCombo('ctrl+tab')).toBe('⌃⇥')
expect(formatCombo('ctrl+shift+tab')).toBe('⌃⇧⇥')
expect(formatCombo('mod+enter')).toBe('⌘↵')
+ expect(formatModifierToken('mod')).toBe('⌘')
})
it.each(['Linux x86_64', 'Win32'])('renders "Ctrl+…" off macOS on %s (base key keeps its glyph)', async platform => {
- const { formatCombo } = await loadCombo(platform)
+ const { formatCombo, formatModifierToken } = await loadCombo(platform)
expect(formatCombo('ctrl+tab')).toBe('Ctrl+⇥')
expect(formatCombo('ctrl+shift+tab')).toBe('Ctrl+Shift+⇥')
expect(formatCombo('mod+enter')).toBe('Ctrl+↵')
+ expect(formatModifierToken('mod')).toBe('Ctrl')
})
it('renders PageUp and PageDown with compact labels', async () => {
diff --git a/apps/desktop/src/lib/keybinds/combo.ts b/apps/desktop/src/lib/keybinds/combo.ts
index 75b025a9c8c..4409142cb45 100644
--- a/apps/desktop/src/lib/keybinds/combo.ts
+++ b/apps/desktop/src/lib/keybinds/combo.ts
@@ -192,7 +192,7 @@ function labelForBase(base: string): string {
return base.length === 1 ? base.toUpperCase() : base
}
-function labelForMod(mod: string): string {
+export function formatModifierToken(mod: string): string {
if (mod === 'mod') {
return IS_MAC ? '⌘' : 'Ctrl'
}
@@ -218,7 +218,7 @@ export function comboTokens(combo: string): string[] {
const parts = combo.split('+')
const base = parts.pop() ?? ''
- return [...parts.map(labelForMod), labelForBase(base)]
+ return [...parts.map(formatModifierToken), labelForBase(base)]
}
// Human-readable label, e.g. "⌘⇧K" on macOS, "Ctrl+Shift+K" elsewhere.