Files
pangolin/client/macos/Runner/MainFlutterWindow.swift
T
wangjia 15133b8a72 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>
2026-06-30 01:27:30 +08:00

31 lines
1.2 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Cocoa
import FlutterMacOS
class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let flutterViewController = FlutterViewController()
self.contentViewController = flutterViewController
// 920×600稿 ui_kits/desktop 720×560
let defaultSize = NSSize(width: 920, height: 600)
self.setContentSize(defaultSize)
self.contentMinSize = NSSize(width: 720, height: 560)
self.center()
RegisterGeneratedPlugins(registry: flutterViewController)
// P1 B:VPN (NETunnelProviderManager PacketTunnel)
// VpnChannel.swift Runner target Compile Sources
VpnChannel.register(with: flutterViewController.registrar(forPlugin: "VpnChannel"))
super.awakeFromNib()
// ( --autostart):,( Windows )
// Dart main() windowManager.hide(); orderOut , storyboard
// "Visible At Launch" ()
if CommandLine.arguments.contains("--autostart") {
self.orderOut(nil)
}
}
}