feat(autostart): macOS / Linux / Windows 三平台开机自启#217
Merged
Conversation
接入官方 tauri-plugin-autostart: - macOS:~/Library/LaunchAgents/com.openless.app.plist (LaunchAgent) - Linux:~/.config/autostart/openless.desktop (XDG) - Windows:HKCU\Software\Microsoft\Windows\CurrentVersion\Run (per-user, 不需要 admin) 设置页 → 录制 区追加「开机自启」Toggle;状态以 OS 为唯一真相, 直接调插件 isEnabled / enable / disable,不进 prefs,避免缓存 与系统设置不一致。 Closes #194
|
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 07c083d)Here are some key observations to aid the review process:
|
原版 AutostartRow 的 onToggle catch 只 console.error + 回滚,
失败完全不在 UI 上反馈:Windows 写 HKCU\Run 被组策略拦、
macOS LaunchAgent plist 写入失败 这些真实场景下,用户只看到
toggle 弹回去,根本不知道为什么。
补一个 error state:
- onToggle 进入清 null,catch 里 setError(message)。
- SettingRow children 改成 flex column:toggle 上面、错误小字下面。
- 配色 var(--ol-err) 跟 about 卡片的 update error 同款。
- i18n 加 settings.recording.startupAtBootError,{{message}} 插
入插件抛的具体错。
不动 isEnabled 失败路径(#194 验收没列);不动 prefs 持久化
策略(仍由 OS 持有真相)。
|
Persistent review updated to latest commit 07c083d |
|
Persistent review updated to latest commit 570a3a4 |
570a3a4 to
07c083d
Compare
|
Persistent review updated to latest commit 07c083d |
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
Closes #194
Summary
tauri-plugin-autostart,零自写:~/Library/LaunchAgents/com.openless.app.plist(LaunchAgent)~/.config/autostart/openless.desktop(XDG)HKCU\Software\Microsoft\Windows\CurrentVersion\Run(per-user,不需 admin)isEnabled/enable/disable,不写 prefs(避免缓存与系统设置不一致)改动
Backend
Cargo.toml:加tauri-plugin-autostart = \"2\"lib.rs:注册插件tauri_plugin_autostart::init(MacosLauncher::LaunchAgent, None)capabilities/default.json:加\"autostart:default\"Frontend
package.json:加@tauri-apps/plugin-autostartSettings.tsx:新增<AutostartRow />子组件(mount 时读 OS 真值,toggle 失败回滚)i18n/zh-CN.ts/en.ts:在settings.recording节点加startupAtBoot+startupAtBootDesc关于 millionart 的「别走注册表」评论
插件无内置的 startup-folder
.lnk模式。HKCU\Run 是 Microsoft 文档化的 per-user 标准方式、不需要管理员,本 issue 验收标准("用户可设置开机启动")已满足。如必须走.lnk,单独追加 follow-up(需要自己写 Windows 子流程)。验证
cargo check通过npm run build(tsc + vite) 通过ls ~/Library/LaunchAgents/ | grep openless,重启或注销 / 登录后 OpenLess 自启ls ~/.config/autostart/,重新登录后自启reg query \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\"看到 OpenLess,重登后自启PR Type
Enhancement
Description
Add cross-platform autostart toggle in Settings
Use OS as source of truth for state
Show error message if toggle fails
Register tauri-plugin-autostart and grant permissions
Diagram Walkthrough
File Walkthrough
4 files
Register autostart plugin initAdd autostart i18n keys in EnglishAdd autostart i18n keys in ChineseImplement AutostartRow with error feedback2 files
Add @tauri-apps/plugin-autostart dependencyAdd tauri-plugin-autostart crate1 files
Grant autostart:default permission