feat(client/macos): 开机自启隐藏到托盘(--autostart),与 Windows 对齐
macOS 登录项(launch_at_startup)注册时带 args:['--autostart'];main() 读该参数 windowManager.hide();MainFlutterWindow.awakeFromNib 检测到 --autostart 时 orderOut 兜底(避免 storyboard Visible At Launch 闪窗)。常规启动无参数,正常显示窗口。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -115,9 +115,14 @@ class SettingsController extends StateNotifier<AppSettings> {
|
||||
await _applyWindowsAutostart(v);
|
||||
return;
|
||||
}
|
||||
// macOS/Linux:登录项即可(无需管理员)。
|
||||
// macOS/Linux:登录项即可(无需管理员)。带 --autostart:登录拉起时隐藏到托盘
|
||||
// (与 Windows 一致;main.dart 读该参数 windowManager.hide(),macOS 原生侧 orderOut 兜底)。
|
||||
final info = await PackageInfo.fromPlatform();
|
||||
launchAtStartup.setup(appName: info.appName, appPath: Platform.resolvedExecutable);
|
||||
launchAtStartup.setup(
|
||||
appName: info.appName,
|
||||
appPath: Platform.resolvedExecutable,
|
||||
args: const ['--autostart'],
|
||||
);
|
||||
if (v) {
|
||||
await launchAtStartup.enable();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user