diff --git a/openless-all/app/src/i18n/en.ts b/openless-all/app/src/i18n/en.ts index 8b408236..9c65ace3 100644 --- a/openless-all/app/src/i18n/en.ts +++ b/openless-all/app/src/i18n/en.ts @@ -268,6 +268,7 @@ export const en: typeof zhCN = { restoreClipboardDesc: 'Windows / Linux only: restore your original clipboard after a successful paste (default on). Turn off to keep the dictation text in the clipboard so you can manually Ctrl+V if the simulated paste did not actually land. See issue #111.', startupAtBoot: 'Launch at login', startupAtBootDesc: 'Start OpenLess automatically when you sign in. macOS uses a LaunchAgent, Linux writes ~/.config/autostart, Windows writes HKCU\\Run (no admin required). See issue #194.', + startupAtBootError: 'Failed to toggle launch at login: {{message}}', }, providers: { llmTitle: 'LLM (polishing)', diff --git a/openless-all/app/src/i18n/zh-CN.ts b/openless-all/app/src/i18n/zh-CN.ts index 825d56d8..402961ab 100644 --- a/openless-all/app/src/i18n/zh-CN.ts +++ b/openless-all/app/src/i18n/zh-CN.ts @@ -266,6 +266,7 @@ export const zhCN = { restoreClipboardDesc: '仅 Windows / Linux:粘贴成功后恢复你原来的剪贴板内容(默认开)。关掉就把听写文本留在剪贴板,模拟粘贴没真正落地时可以手动 Ctrl+V 找回。详见 issue #111。', startupAtBoot: '开机自启', startupAtBootDesc: '登录后自动启动 OpenLess。macOS 写 LaunchAgent,Linux 写 ~/.config/autostart,Windows 写 HKCU\\Run(不需要管理员)。详见 issue #194。', + startupAtBootError: '开机自启切换失败:{{message}}', }, providers: { llmTitle: 'LLM 模型(润色)', diff --git a/openless-all/app/src/pages/Settings.tsx b/openless-all/app/src/pages/Settings.tsx index de370263..7795c0e6 100644 --- a/openless-all/app/src/pages/Settings.tsx +++ b/openless-all/app/src/pages/Settings.tsx @@ -248,6 +248,10 @@ function AutostartRow() { const { t } = useTranslation(); const [enabled, setEnabled] = useState(false); const [loaded, setLoaded] = useState(false); + // 切 plist / 注册表失败时给用户看的错误。null = 没有失败/上次操作已成功。 + // 不渲染等于把失败吞掉 —— Windows 写 HKCU\Run 被组策略拦、macOS 写 + // LaunchAgent plist 权限不够 都是真实可能。issue #194。 + const [error, setError] = useState(null); useEffect(() => { let cancelled = false; @@ -269,12 +273,14 @@ function AutostartRow() { const onToggle = async (next: boolean) => { setEnabled(next); + setError(null); try { if (next) await enableAutostart(); else await disableAutostart(); } catch (err) { console.error('[autostart] toggle failed', err); setEnabled(!next); + setError(err instanceof Error ? err.message : String(err)); } }; @@ -283,7 +289,14 @@ function AutostartRow() { label={t('settings.recording.startupAtBoot')} desc={t('settings.recording.startupAtBootDesc')} > - {loaded ? : null} +
+ {loaded ? : null} + {error && ( +
+ {t('settings.recording.startupAtBootError', { message: error })} +
+ )} +
); }