mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-10-30 06:03:48 +00:00
feat(menu): add diagnostics window entry
This commit is contained in:
@@ -74,6 +74,9 @@ struct ShadowsocksXNG2App: App {
|
||||
workspaceContent
|
||||
.modifier(WindowActivationPolicy(coordinator: windowActivation))
|
||||
}
|
||||
.commands {
|
||||
DiagnosticsCommands()
|
||||
}
|
||||
.defaultLaunchBehavior(launchPresentation)
|
||||
.defaultSize(width: 960, height: 640)
|
||||
.windowToolbarLabelStyle($toolbarLabelStyle)
|
||||
@@ -112,6 +115,19 @@ struct ShadowsocksXNG2App: App {
|
||||
}
|
||||
}
|
||||
|
||||
/// 应用名称菜单中的诊断窗口入口。
|
||||
private struct DiagnosticsCommands: Commands {
|
||||
@Environment(\.openWindow) private var openWindow
|
||||
|
||||
var body: some Commands {
|
||||
CommandGroup(after: .appInfo) {
|
||||
Button("诊断…") {
|
||||
openWindow(id: DiagnosticsWindowState.sceneID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 随窗激活策略与激活重试的真实 NSApp 落点。
|
||||
@MainActor
|
||||
private final class NSAppWindowActivationApplier: WindowActivationPolicyApplying {
|
||||
|
||||
Reference in New Issue
Block a user