feat(startup): add "start minimized" toggle (Windows background autostart)#357
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
PR Reviewer Guide 🔍(Review updated until commit f6474be)Here are some key observations to aid the review process:
|
…ound mode) 回应用户「Windows 端开机启动时不弹软件界面、自动后台启动」需求。 新 pref start_minimized: bool,默认 false 不破坏现有行为。打开后所有 启动路径都不弹主窗口(包括开机自启 + 手动启动),App 仅在菜单栏 / 托盘 运行;用户从托盘进入主窗口。Windows 开机自启场景用得多——本来想要 后台 + 托盘,不想被主窗口打扰。 设计选择:不区分"自启动 vs 手动启动"——开关一开则所有启动统一静默。 理由:避免 argv parsing + 重新注册 autostart 带来的复杂性(tauri-plugin- autostart 的 args 是 init() 时静态设的、动态切需要重注册)。开关明确 打开 = 接受所有启动都从托盘进。 实现: - types.rs: UserPreferences 加 start_minimized 字段(含 UserPreferencesWire + Default + Deserialize 全套兼容) - lib.rs setup hook: 读 coordinator.prefs().get().start_minimized;为 true 时跳过 main.show()。OPENLESS_SHOW_MAIN_ON_START=1 仍保留老的强制 show 路径(dev 用),优先级高于 prefs - 前端 types.ts / ipc.ts mockSettings / stylePrefs.test.ts: 加默认 false - Settings.tsx Recording 区在 AutostartRow 下加 Toggle - i18n 5 locale (zh-CN / zh-TW / en / ja / ko) 加 startMinimizedLabel + startMinimizedDesc 两个 key 顺手修预存 bug(跟 PR #355 副 commit 同源——本 branch 没含那个修复): HotkeyBinding default keys=None,避免旧 prefs 反序列化时 trigger / keys 不一致。types::tests 8/8 pass。 不在本 PR:Windows IME 切换还原偶发不还原 bug——需要 Windows 日志 + 复现条件才能定位,盲改可能引入新 bug。已请求用户提供 %LOCALAPPDATA%\OpenLess\Logs\openless.log + 系统版本 + IME 信息。 cargo test --lib: 135/135 pass。npm run build: tsc + vite 干净。
37225b4 to
f6474be
Compare
|
Persistent review updated to latest commit f6474be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
What
回应用户:「Windows 端增加一个在开机启动的时候不弹出软件界面、自动在后台启动的开关」。
新 pref `start_minimized: bool`,默认 false 不破坏现有行为。打开后所有启动路径都不弹主窗口(包括开机自启 + 手动启动),App 仅在菜单栏 / 托盘运行;用户从托盘进入主窗口。
Why this design (单开关,不区分启动来源)
最 surgical 的实现是 "prefs.start_minimized = true → 跳过 main.show()",不区分自启动 vs 手动启动。
如果非要区分("只在自启动时静默、手动启动仍弹窗"):
复杂度跟收益不成比例。简单设计:开关一开就所有启动统一静默,用户接受"从此从托盘进主窗口"的契约。开机自启场景下这正是想要的;手动启动场景下也容易接受(点托盘比一直关主窗口轻)。
Files
顺手修预存 bug
HotkeyBinding default keys=None(跟 PR #355 副 commit 同源——本 branch 没含那个修复)。避免旧 prefs 反序列化时 trigger / keys 不一致导致快捷键失效。`types::tests` 8/8 pass。
不在本 PR:Windows IME 切换还原偶发 bug
用户也报了「使用 OpenLess 后输入法应自动切回之前的 IME,部分系统正常、部分不正常」。
这一条不能盲改:是个偶发 bug,需要:
已请求用户提供。拿到数据后单独开 PR 修。
验证
```
cargo test --lib: 135/135 pass
npm run build: tsc + vite 干净
cargo check: 干净(79 warnings 均预存)
```
无法在 macOS 上实测 Windows 行为;setup hook 中 `prefs.start_minimized` 读取 + `main.show()` 跳过逻辑跨平台一致,理论上 Windows 同样生效。
Test plan
PR Type
Enhancement
Description
Add
start_minimizedboolean preference (default false)Suppress main window show on launch when enabled, keeping only tray icon
Expose toggle in Recording settings with i18n for 5 locales
Diagram Walkthrough
File Walkthrough
4 files
Suppress main window show when start_minimized is setAdd start_minimized field to UserPreferences and wireAdd start_minimized to frontend preferences typeAdd toggle for start minimized in Recording settings6 files
Localize start minimized label and description (English)Localize start minimized label and description (Japanese)Localize start minimized label and description (Korean)Localize start minimized label and description (Simplified Chinese)Localize start minimized label and description (Traditional Chinese)Add start_minimized default in mock preferences1 files
Update preference fixture with start_minimized default