The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): ship a Windows voice chord that is not the sidebar toggle
brooklyn!30565b2db235
diff --git a/apps/desktop/src/app/chat/composer/focus.ts b/apps/desktop/src/app/chat/composer/focus.tsindex f7fef135314..5ce7895965d 100644--- a/apps/desktop/src/app/chat/composer/focus.ts+++ b/apps/desktop/src/app/chat/composer/focus.ts@@ -636,7 +636,7 @@ export const onComposerSubmitRequest = (handler: (detail: SubmitDetail) => void)subscribe<SubmitDetail>(SUBMIT_EVENT, handler)/** Toggle ONE composer's voice conversation — the `composer.voice` hotkey- * (Ctrl+B) reaches the composer that owns voice. Defaults to the active+ * reaches the composer that owns voice. Defaults to the active* composer so N tiles don't all flip together. */export const requestVoiceToggle = (target: ComposerTarget | 'active' = 'active') =>dispatch<{ target: ComposerTarget }>(VOICE_TOGGLE_EVENT, { target: resolve(target) })diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-voice.ts b/apps/desktop/src/app/chat/composer/hooks/use-composer-voice.tsindex a411dbcc62c..4283577cc8d 100644--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-voice.ts+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-voice.ts@@ -292,7 +292,7 @@ export function useComposerVoice({[])- // The `composer.voice` hotkey (Ctrl+B) toggles the conversation. Starting+ // The `composer.voice` hotkey toggles the conversation. Starting// with STT unconfigured lets the conversation surface its own "configure// speech-to-text" notice rather than silently no-opping.const toggleVoiceConversation = useCallback(() => {diff --git a/apps/desktop/src/app/hooks/use-keybinds.ts b/apps/desktop/src/app/hooks/use-keybinds.tsindex e98bceb0380..86049193ab4 100644--- a/apps/desktop/src/app/hooks/use-keybinds.ts+++ b/apps/desktop/src/app/hooks/use-keybinds.ts@@ -31,7 +31,7 @@ import {} from '@/store/find-in-page'import { toggleHud } from '@/store/hud'import { toggleSimpleMode } from '@/store/interface-mode'-import { $capture, $comboIndex, endCapture, setBinding } from '@/store/keybinds'+import { $capture, $comboIndex, captureStep, endCapture, setBinding } from '@/store/keybinds'import {cycleSidebarGrouping,requestSessionSearchFocus,@@ -379,27 +379,26 @@ export function useKeybinds(deps: KeybindRuntimeDeps): void {return}- // Capture mode: the next real key becomes the binding. Swallow everything- // so e.g. ⌘K rebinds instead of opening the palette.+ // Capture mode: the next real key becomes the binding. Backspace/Delete+ // clears it (empty combos) so a shipped chord like the sidebar's mod+b+ // can be unbound. Escape cancels. Swallow everything so e.g. ⌘K rebinds+ // instead of opening the palette.const capturing = $capture.get()if (capturing) {event.preventDefault()event.stopPropagation()- if (event.key === 'Escape') {- endCapture()+ const step = captureStep(event.key, comboFromEvent(event))+ if (step.type === 'wait') {return}- const combo = comboFromEvent(event)-- if (!combo) {- return+ if (step.type === 'set') {+ setBinding(capturing, step.combos)}- setBinding(capturing, [combo])endCapture()returndiff --git a/apps/desktop/src/app/settings/keybind-settings.tsx b/apps/desktop/src/app/settings/keybind-settings.tsxindex 9412fba7efe..1cb4b71c65d 100644--- a/apps/desktop/src/app/settings/keybind-settings.tsx+++ b/apps/desktop/src/app/settings/keybind-settings.tsx@@ -24,6 +24,7 @@ import {$capture,beginCapture,bindingsFor,+ clearBinding,conflictsFor,endCapture,resetAllBindings,@@ -272,10 +273,23 @@ function KeybindRow({ action }: { action: KeybindActionMeta }) {</button></Tip>- {/* Reset only shows once a binding diverges from its default; the spacer- holds the column otherwise so rows stay aligned. */}+ {/* Reset shows once a binding diverges from its default. A shipped chord+ (sidebar mod+b) has no reset, so that same slot clears it instead. */}{isDefault ? (- <span aria-hidden className="size-6 shrink-0" />+ combos.length > 0 ? (+ <Tip label={k.clear}>+ <button+ aria-label={k.clear}+ className="grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground/70 opacity-0 transition-all hover:bg-(--ui-control-active-background) hover:text-foreground group-hover:opacity-100"+ onClick={() => clearBinding(action.id)}+ type="button"+ >+ <Codicon name="close" size="0.8125rem" />+ </button>+ </Tip>+ ) : (+ <span aria-hidden className="size-6 shrink-0" />+ )) : (<Tip label={k.reset}><buttondiff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex a14f453c142..152a923b3ba 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -910,7 +910,7 @@ export const ar = defineLocale({invalidJson: 'JSON غير صالح',voiceShortcutHintTitle: 'اختصار تسجيل الصوت',voiceShortcutHintDesc:- 'اضبط اختصار تسجيل الصوت من الإعدادات ← اختصارات لوحة المفاتيح («بدء / إيقاف الإملاء»). قيمة voice.record_key مخصصة لـ CLI وTUI فقط.'+ 'اضبط اختصار تسجيل الصوت من الإعدادات ← اختصارات لوحة المفاتيح («بدء / إيقاف المحادثة الصوتية»). قيمة voice.record_key مخصصة لـ CLI وTUI فقط.'},hudModifier: {title: 'استدعاء HUD بضغطة',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 0277862e8b3..65c7a3b44e5 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -619,6 +619,7 @@ export const en: Translations = {rebind: 'Rebind',reset: 'Reset to default',resetAll: 'Reset all',+ clear: 'Clear',pressKey: 'Press a key…',set: 'set',conflictWith: label => `Also bound to “${label}”`,@@ -1347,7 +1348,7 @@ export const en: Translations = {attachmentSizeLabel: 'Max preview / image load size in megabytes',voiceShortcutHintTitle: 'Voice recording shortcut',voiceShortcutHintDesc:- 'Set the voice recording shortcut in Settings → Keyboard Shortcuts ("Start / stop dictation"). The voice.record_key config value only applies to the CLI and TUI.',+ 'Set the voice recording shortcut in Settings → Keyboard Shortcuts ("Start / stop voice conversation"). The voice.record_key config value only applies to the CLI and TUI.',showOptions: 'Show options'},hudModifier: {diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 0d2e615d157..53a85b8110b 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -1028,7 +1028,7 @@ export const ja = defineLocale({keepAwakeDesc: '本体のスリープを防ぎ、長時間や夜通しの実行を継続します。画面は暗転できます。',voiceShortcutHintTitle: '音声録音ショートカット',voiceShortcutHintDesc:- '「設定 → キーボードショートカット」で音声録音ショートカット(「音声入力を開始 / 停止」)を設定します。voice.record_key は CLI と TUI 専用です。'+ '「設定 → キーボードショートカット」で音声録音ショートカット(「Start / stop voice conversation」)を設定します。voice.record_key は CLI と TUI 専用です。'},hudModifier: {title: 'キーをタップして HUD を呼び出す',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 5413aee915c..6b17fe5d909 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -1093,7 +1093,7 @@ export const ru = defineLocale({attachmentSizeLabel: 'Макс. размер превью / загрузки изображений в мегабайтах',voiceShortcutHintTitle: 'Горячая клавиша записи голоса',voiceShortcutHintDesc:- 'Настройте горячую клавишу записи голоса в разделе «Настройки → Горячие клавиши» («Начать / остановить диктовку»). Параметр voice.record_key действует только в CLI и TUI.'+ 'Настройте горячую клавишу записи голоса в разделе «Настройки → Горячие клавиши» («Начать / остановить голосовой диалог»). Параметр voice.record_key действует только в CLI и TUI.'},hudModifier: {title: 'Вызов HUD коротким нажатием',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 05ad3117d76..c67705ee77c 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -638,6 +638,7 @@ export interface Translations {rebind: stringreset: stringresetAll: string+ clear: stringpressKey: stringset: stringconflictWith: (label: string) => stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 9ae37d8a6f8..081d04db4f9 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -1088,7 +1088,7 @@ export const zhHant = defineLocale({keepAwakeDesc: '阻止本機睡眠,讓長時間或整夜執行持續進行。螢幕仍可變暗。',voiceShortcutHintTitle: '語音錄製快捷鍵',voiceShortcutHintDesc:- '請在「設定 → 鍵盤快捷鍵」中設定語音錄製快捷鍵(「開始 / 停止聽寫」)。voice.record_key 設定僅適用於 CLI 和 TUI。',+ '請在「設定 → 鍵盤快捷鍵」中設定語音錄製快捷鍵(「Start / stop voice conversation」)。voice.record_key 設定僅適用於 CLI 和 TUI。',showOptions: '顯示選項'},hudModifier: {diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex d736468185e..335f1e96198 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -1310,7 +1310,7 @@ export const zh = defineLocale({attachmentSizeLabel: '预览 / 图片加载大小上限(MB)',voiceShortcutHintTitle: '语音录制快捷键',voiceShortcutHintDesc:- '请在“设置 → 键盘快捷键”中设置语音录制快捷键(“开始 / 停止听写”)。voice.record_key 配置项仅适用于 CLI 和 TUI。',+ '请在“设置 → 键盘快捷键”中设置语音录制快捷键(“开始 / 停止语音对话”)。voice.record_key 配置项仅适用于 CLI 和 TUI。',showOptions: '显示选项'},hudModifier: {diff --git a/apps/desktop/src/lib/desktop-slash-commands.ts b/apps/desktop/src/lib/desktop-slash-commands.tsindex fd56b31101e..f9528821066 100644--- a/apps/desktop/src/lib/desktop-slash-commands.ts+++ b/apps/desktop/src/lib/desktop-slash-commands.ts@@ -463,7 +463,7 @@ const UNAVAILABLE_MESSAGE: Record<DesktopUnavailableReason, (command: string) =>advanced: command =>`${command} is not shown in the desktop slash palette. Use the relevant desktop control or terminal interface instead.`,'composer-voice': () =>- 'Voice chat lives in the composer here: click the microphone button and choose "Start voice chat" (or press Ctrl+B).',+ 'Voice chat lives in the composer here: click the microphone button and choose "Start voice chat", or use the voice shortcut from Settings → Keyboard Shortcuts.',messaging: command => `${command} is only used from messaging platforms.`,settings: command => `${command} is managed from the desktop sidebar.`,terminal: command => `${command} is only available in the terminal interface.`diff --git a/apps/desktop/src/lib/keybinds/actions.test.ts b/apps/desktop/src/lib/keybinds/actions.test.tsindex b3ad202d612..cbafe8ab09c 100644--- a/apps/desktop/src/lib/keybinds/actions.test.ts+++ b/apps/desktop/src/lib/keybinds/actions.test.ts@@ -1,8 +1,10 @@import { describe, expect, it } from 'vitest'+import { TRANSLATIONS } from '@/i18n/catalog'import { en } from '@/i18n/en'-import { defaultBindings, KEYBIND_ACTIONS, keybindAction } from './actions'+import { defaultBindings, KEYBIND_ACTIONS, KEYBIND_READONLY, keybindAction } from './actions'+import { canonicalizeCombo } from './combo'// Relationship checks between the action table and its consumers, not the// specific chord or wording any one action ships with.@@ -37,4 +39,50 @@ describe('KEYBIND_ACTIONS', () => {expect(en.keybinds.actions['composer.dictate']).toBe('Start / stop dictation')expect(KEYBIND_ACTIONS.filter(candidate => candidate.id === 'composer.dictate')).toHaveLength(1)})++ // jsdom never reports a Mac platform, so this is the Windows/Linux default.+ // Don't fake the host OS — assert the chord this runtime actually ships.+ it('ships a voice chord that does not claim the sidebar chord or any other shipped combo', () => {+ const voice = defaultBindings()['composer.voice'].map(canonicalizeCombo)++ expect(voice.length).toBeGreaterThan(0)++ const taken = new Set<string>()++ for (const action of KEYBIND_ACTIONS) {+ if (action.id === 'composer.voice') {+ continue+ }++ for (const combo of action.defaults) {+ taken.add(canonicalizeCombo(combo))+ }+ }++ for (const shortcut of KEYBIND_READONLY) {+ for (const combo of shortcut.keys) {+ taken.add(canonicalizeCombo(combo))+ }+ }++ expect(voice.filter(combo => taken.has(combo))).toEqual([])+ expect(voice).not.toContain(canonicalizeCombo('mod+b'))+ })++ it('points Voice settings hints at the voice conversation action, not dictation', () => {+ const englishVoice = en.keybinds.actions['composer.voice']++ for (const [locale, messages] of Object.entries(TRANSLATIONS)) {+ const voice = messages.keybinds.actions['composer.voice']+ const dictate = messages.keybinds.actions['composer.dictate']+ const hint = messages.settings.config.voiceShortcutHintDesc+ const namesVoice = hint.includes(voice) || hint.includes(englishVoice)++ expect(namesVoice, locale).toBe(true)++ if (dictate !== voice) {+ expect(hint.includes(dictate), locale).toBe(false)+ }+ }+ })})diff --git a/apps/desktop/src/lib/keybinds/actions.ts b/apps/desktop/src/lib/keybinds/actions.tsindex fa59fa0e876..e476cbad947 100644--- a/apps/desktop/src/lib/keybinds/actions.ts+++ b/apps/desktop/src/lib/keybinds/actions.ts@@ -62,9 +62,10 @@ export const KEYBIND_ACTIONS: readonly KeybindActionMeta[] = [// live dropdown on the pane under the pointer, else the active composer.{ id: 'composer.modelPicker', category: 'composer', defaults: ['mod+shift+m'] },// Voice conversation toggle. On macOS that's literally ⌃B — distinct from- // the ⌘B sidebar toggle. Off macOS `ctrl` folds to `mod`, which IS the- // ⌘B/Ctrl+B sidebar chord, so ship it unbound there.- { id: 'composer.voice', category: 'composer', defaults: IS_MAC ? ['ctrl+b'] : [] },+ // the ⌘B sidebar toggle. Off macOS `ctrl` folds to `mod`, so ⌃B IS the+ // sidebar chord. Ship ⌃⌥V there ("v" for voice) instead of stealing mod+b+ // or leaving the action unbound.+ { id: 'composer.voice', category: 'composer', defaults: IS_MAC ? ['ctrl+b'] : ['mod+alt+v'] },// Dictation is intentionally unbound: it is available for users who prefer// a keyboard trigger without claiming a chord from text entry by default.{ id: 'composer.dictate', category: 'composer', defaults: [] },diff --git a/apps/desktop/src/store/keybinds.test.ts b/apps/desktop/src/store/keybinds.test.tsindex 12d785ac38a..90a2a17218c 100644--- a/apps/desktop/src/store/keybinds.test.ts+++ b/apps/desktop/src/store/keybinds.test.ts@@ -58,4 +58,30 @@ describe('keybinds store persist vs late-registered contributed actions', () =>})expect(bindingsFor('demo.late')).toEqual(['mod+alt+l'])})++ it('keeps an explicitly cleared sidebar binding empty so mod+b can be unbound', async () => {+ const { $comboIndex, bindingsFor, setBinding } = await import('./keybinds')++ setBinding('view.toggleSidebar', [])++ expect(bindingsFor('view.toggleSidebar')).toEqual([])+ expect($comboIndex.get().get('mod+b')).toBeUndefined()+ expect(storedDiff()['view.toggleSidebar']).toEqual([])++ vi.resetModules()+ const reloaded = await import('./keybinds')++ expect(reloaded.bindingsFor('view.toggleSidebar')).toEqual([])+ expect(reloaded.$comboIndex.get().get('mod+b')).toBeUndefined()+ })++ it('treats Backspace and Delete during capture as a cleared binding', async () => {+ const keybinds = await import('./keybinds')++ expect(keybinds.captureStep('Backspace', null)).toEqual({ type: 'set', combos: [] })+ expect(keybinds.captureStep('Delete', 'mod+b')).toEqual({ type: 'set', combos: [] })+ expect(keybinds.captureStep('Escape', null)).toEqual({ type: 'cancel' })+ expect(keybinds.captureStep('b', null)).toEqual({ type: 'wait' })+ expect(keybinds.captureStep('b', 'mod+b')).toEqual({ type: 'set', combos: ['mod+b'] })+ })})diff --git a/apps/desktop/src/store/keybinds.ts b/apps/desktop/src/store/keybinds.tsindex 4baede8b288..0c2b3f52c50 100644--- a/apps/desktop/src/store/keybinds.ts+++ b/apps/desktop/src/store/keybinds.ts@@ -43,7 +43,9 @@ function loadBindings(): KeybindBindings {const base = defaultBindings()for (const id of Object.keys(base)) {- if (storedOverrides[id]) {+ // Empty combos are a cleared binding, not a missing one. Object.hasOwn+ // keeps a stored [] (sidebar unbound) from falling back to the shipped default.+ if (Object.hasOwn(storedOverrides, id)) {base[id] = storedOverrides[id]}}@@ -117,6 +119,11 @@ export function setBinding(actionId: string, combos: string[]): void {$bindings.set({ ...$bindings.get(), [actionId]: [...combos] })}+/** Drop every combo. Empty is persisted, so a shipped default stays unbound. */+export function clearBinding(actionId: string): void {+ setBinding(actionId, [])+}+export function resetBinding(actionId: string): void {const action = keybindAction(actionId)@@ -153,3 +160,24 @@ export function beginCapture(actionId: string): void {export function endCapture(): void {$capture.set(null)}++export type CaptureStep = { type: 'cancel' } | { type: 'set'; combos: string[] } | { type: 'wait' }++// Capture-mode keydown. Backspace/Delete record an empty combo so a shipped+// chord (sidebar mod+b) can be unbound. Escape cancels. A modifier-only press+// (`combo == null`) keeps waiting for a real key.+export function captureStep(key: string, combo: string | null): CaptureStep {+ if (key === 'Escape') {+ return { type: 'cancel' }+ }++ if (key === 'Backspace' || key === 'Delete') {+ return { type: 'set', combos: [] }+ }++ if (!combo) {+ return { type: 'wait' }+ }++ return { type: 'set', combos: [combo] }+}