feat(client): 开机自启拉起直接最小化到托盘(--autostart 标志)(1.0.28)
计划任务 /tr 命令带 --autostart;main() 检测到该参数在首帧前 windowManager.hide() 隐藏主窗口到托盘,自动连接逻辑照常跑。手动打开(无参数)仍正常显示窗口。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -130,12 +130,13 @@ class SettingsController extends StateNotifier<AppSettings> {
|
||||
|
||||
// 用 schtasks 建/删最高权限登录触发任务。app 已是管理员 → 可建 /rl highest 任务,
|
||||
// 开机由计划程序静默提权拉起、不弹 UAC。/tr 含空格路径须内嵌引号。
|
||||
// 带 --autostart 标志:让开机拉起的实例直接最小化到托盘(不弹主窗口),见 main.dart。
|
||||
Future<void> _applyWindowsAutostart(bool v) async {
|
||||
if (v) {
|
||||
final exe = Platform.resolvedExecutable;
|
||||
await Process.run('schtasks', [
|
||||
'/create', '/tn', _kWinTaskName,
|
||||
'/tr', '"$exe"',
|
||||
'/tr', '"$exe" --autostart',
|
||||
'/sc', 'onlogon',
|
||||
'/rl', 'highest',
|
||||
'/f',
|
||||
|
||||
Reference in New Issue
Block a user