feat(less-computer): 「按住说话键」挪到 通用→快捷键,去掉高级里的重复
- 通用 → 快捷键 新增 Less Computer 行(macOS):可直接启用并录制按住说话键, 和听写/翻译/QA/切风格/打开应用一排,用户一眼就能看到(之前埋在高级里)。 启用按钮一键置 codingAgentEnabled=true + 默认键,保存即触发后端重新注册。 - 高级 → Less Computer 移除重复的按住说话键行,只留后端/模型/权限/工作目录。 - tsc 0。
This commit is contained in:
1 parent
0082e0bf0e
commit
dae966ffd1
2 files changed
+33
-26
No files matched your search
@@ -1,10 +1,9 @@
|
||||
// 高级 → Less Computer 配置:启用开关、按住说话快捷键、Claude / OpenCode、模型 / 权限模式 / 工作目录。
|
||||
// 高级 → Less Computer 配置:启用开关、后端(Claude / OpenCode)、模型 / 权限模式 / 工作目录。
|
||||
// 「按住说话键」在 通用 → 快捷键 里配置(见 ShortcutsSection),这里不再重复。
|
||||
// 配置经 UserPreferences 持久化;启用后 coordinator 才注册热键。
|
||||
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { ShortcutRecorder } from '../../components/ShortcutRecorder'
|
||||
import { detectOS } from '../../components/WindowChrome'
|
||||
import { defaultLessComputerShortcut } from '../../lib/hotkey'
|
||||
import type { CodingAgentPermissionMode, CodingAgentProviderId } from '../../lib/types'
|
||||
import { useHotkeySettings } from '../../state/HotkeySettingsContext'
|
||||
import { Card } from '../_atoms'
|
||||
@@ -48,28 +47,7 @@ export function CodingAgentSection() {
|
||||
|
||||
{enabled && (
|
||||
<>
|
||||
<SettingRow label={t('settings.codingAgent.voiceHotkey')} desc={t('settings.codingAgent.voiceHotkeyDesc')}>
|
||||
{prefs.codingAgentVoiceHotkey ? (
|
||||
<ShortcutRecorder
|
||||
value={prefs.codingAgentVoiceHotkey}
|
||||
alignRecordButton
|
||||
onSave={async binding => {
|
||||
await savePrefs({ ...prefs, codingAgentVoiceHotkey: binding })
|
||||
}}
|
||||
onDisable={async () => {
|
||||
await savePrefs({ ...prefs, codingAgentVoiceHotkey: null })
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<button
|
||||
onClick={() => void savePrefs({ ...prefs, codingAgentVoiceHotkey: defaultLessComputerShortcut() })}
|
||||
style={{ fontSize: 12, padding: '5px 14px', background: 'var(--ol-blue)', color: '#fff', border: 0, borderRadius: 6, fontFamily: 'inherit', fontWeight: 500, cursor: 'pointer' }}
|
||||
>
|
||||
{t('settings.shortcuts.enable', 'Enable')}
|
||||
</button>
|
||||
)}
|
||||
</SettingRow>
|
||||
|
||||
{/* 「按住说话键」配置已挪到 通用 → 快捷键,避免和这里重复。本区只留后端/模型等高级项。 */}
|
||||
<SettingRow label={t('settings.codingAgent.provider')}>
|
||||
<select
|
||||
value={prefs.codingAgentProvider}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type { CSSProperties } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ShortcutRecorder } from '../../components/ShortcutRecorder';
|
||||
import { defaultOpenAppShortcut, defaultQaShortcut, defaultSwitchStyleShortcut } from '../../lib/hotkey';
|
||||
import { defaultLessComputerShortcut, defaultOpenAppShortcut, defaultQaShortcut, defaultSwitchStyleShortcut } from '../../lib/hotkey';
|
||||
import {
|
||||
setDictationHotkey,
|
||||
setOpenAppHotkey,
|
||||
@@ -155,6 +155,35 @@ export function ShortcutsSection() {
|
||||
</button>
|
||||
)}
|
||||
</SettingRow>
|
||||
{os === 'mac' && (
|
||||
<SettingRow label={t('settings.codingAgent.title')} desc={t('settings.codingAgent.voiceHotkeyDesc')}>
|
||||
{prefs.codingAgentEnabled && prefs.codingAgentVoiceHotkey ? (
|
||||
<ShortcutRecorder
|
||||
value={prefs.codingAgentVoiceHotkey}
|
||||
alignRecordButton
|
||||
onSave={async binding => {
|
||||
await savePrefs({ ...prefs, codingAgentVoiceHotkey: binding });
|
||||
}}
|
||||
onDisable={async () => {
|
||||
await savePrefs({ ...prefs, codingAgentVoiceHotkey: null });
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<button
|
||||
onClick={() =>
|
||||
void savePrefs({
|
||||
...prefs,
|
||||
codingAgentEnabled: true,
|
||||
codingAgentVoiceHotkey: prefs.codingAgentVoiceHotkey ?? defaultLessComputerShortcut(),
|
||||
})
|
||||
}
|
||||
style={enableBtnStyle}
|
||||
>
|
||||
{t('settings.shortcuts.enable', 'Enable')}
|
||||
</button>
|
||||
)}
|
||||
</SettingRow>
|
||||
)}
|
||||
{readonlyRows.map(([k, v]) => (
|
||||
<SettingRow key={k} label={k}>
|
||||
<kbd style={{
|
||||
|
||||
Reference in new issue
Block a user