From 5816f189ed5fb0bb8bedef8200cee198164fcce2 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Mon, 29 Jun 2026 00:15:37 +0800
Subject: [PATCH] docs: simplify CODEGRAPH validation commands
---
C1.source/Sources/Aligner/AlignerApplicationDelegate.swift | 84 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 76 insertions(+), 8 deletions(-)
diff --git a/C1.source/Sources/Aligner/AlignerApplicationDelegate.swift b/C1.source/Sources/Aligner/AlignerApplicationDelegate.swift
index 89c2a16..9904f96 100644
--- a/C1.source/Sources/Aligner/AlignerApplicationDelegate.swift
+++ b/C1.source/Sources/Aligner/AlignerApplicationDelegate.swift
@@ -14,6 +14,7 @@
private let round1SnapshotDumpOptions = Round1SnapshotDumpOptions.parse(arguments: ProcessInfo.processInfo.arguments)
private let round1ScreenshotProbeOptions = Round1ScreenshotProbeOptions.parse(arguments: ProcessInfo.processInfo.arguments)
private let round1QuickSwitchOptions = Round1QuickSwitchLaunchOptions.parse(arguments: ProcessInfo.processInfo.arguments)
+ private let round015EntitlementOptions = Round015EntitlementLaunchOptions.parse(arguments: ProcessInfo.processInfo.arguments)
private var permissionWindowController: PermissionsWindowController?
private var debugOverlayController: Round0DebugOverlayController?
private var round1PerformancePoCController: Round1PerformancePoCController?
@@ -22,6 +23,7 @@
private var quickSwitchTriggerService: CGEventTapTriggerService?
private var settingsWindowController: SettingsWindowController?
private var isRunningQuickSwitchLifecycle = false
+ private var lastQuickSwitchOpenRequestSource: String?
private var statusItem: NSStatusItem?
private var verticalWaterfallViewModeMenuItems: [NSMenuItem] = []
private var horizontalWaterfallViewModeMenuItems: [NSMenuItem] = []
@@ -87,7 +89,8 @@
"hasVisibleWindows": flag,
"activationPolicy": sender.activationPolicy().rawValue
])
- return true
+ openQuickSwitchFromDockReopen(hasVisibleWindows: flag)
+ return false
}
private func configureStatusItem() {
@@ -441,10 +444,13 @@
}
private func showQuickSwitchIfRequested() {
- guard round1QuickSwitchOptions.openQuickSwitch || round1QuickSwitchOptions.lifecycleCycles != nil else { return }
+ guard round1QuickSwitchOptions.openQuickSwitch
+ || round1QuickSwitchOptions.lifecycleCycles != nil
+ || round1QuickSwitchOptions.simulateDockReopenAfter != nil else { return }
DevelopmentDiagnostics.log("app.quickSwitch.launchOptionRequested", [
"openQuickSwitch": round1QuickSwitchOptions.openQuickSwitch,
- "lifecycleCycles": round1QuickSwitchOptions.lifecycleCycles
+ "lifecycleCycles": round1QuickSwitchOptions.lifecycleCycles,
+ "simulateDockReopenAfter": round1QuickSwitchOptions.simulateDockReopenAfter
])
if let lifecycleCycles = round1QuickSwitchOptions.lifecycleCycles {
@@ -452,9 +458,23 @@
return
}
- openQuickSwitchFromTrigger()
- writeQuickSwitchReportIfNeeded()
+ if let simulateDockReopenAfter = round1QuickSwitchOptions.simulateDockReopenAfter {
+ DispatchQueue.main.asyncAfter(deadline: .now() + simulateDockReopenAfter) { [weak self] in
+ guard let self else { return }
+ let hasVisibleWindows = NSApp.windows.contains { $0.isVisible }
+ self.openQuickSwitchFromDockReopen(hasVisibleWindows: hasVisibleWindows)
+ self.writeQuickSwitchReportIfNeeded()
+ self.scheduleQuickSwitchAutoHideAndQuitIfNeeded()
+ }
+ return
+ }
+ openQuickSwitchFromTrigger(source: "launchOption")
+ writeQuickSwitchReportIfNeeded()
+ scheduleQuickSwitchAutoHideAndQuitIfNeeded()
+ }
+
+ private func scheduleQuickSwitchAutoHideAndQuitIfNeeded() {
if let autoHideAfter = round1QuickSwitchOptions.autoHideAfter {
DispatchQueue.main.asyncAfter(deadline: .now() + autoHideAfter) { [weak self] in
self?.hideQuickSwitchSession(reason: .timeout)
@@ -533,9 +553,19 @@
}
}
- private func openQuickSwitchFromTrigger() {
+ private func openQuickSwitchFromDockReopen(hasVisibleWindows: Bool) {
+ DevelopmentDiagnostics.log("app.quickSwitch.openFromDockReopen", [
+ "hasVisibleWindows": hasVisibleWindows,
+ "alreadyVisible": quickSwitchSessionController?.isVisible ?? false
+ ])
+ openQuickSwitchFromTrigger(source: "dockReopen")
+ }
+
+ private func openQuickSwitchFromTrigger(source: String = "trigger") {
+ lastQuickSwitchOpenRequestSource = source
let accessibility = accessibilityStatus()
DevelopmentDiagnostics.log("app.quickSwitch.openFromTrigger", [
+ "source": source,
"accessibility": permissionStatusString(accessibility),
"screenRecording": permissionStatusString(screenRecordingStatus()),
"alreadyVisible": quickSwitchSessionController?.isVisible ?? false
@@ -617,6 +647,8 @@
report["resolvedWaterfallViewMode"] = quickSwitchWaterfallViewMode().rawValue
report["preferenceTheme"] = preferenceStore.read().theme.rawValue
report["resolvedQuickSwitchTheme"] = quickSwitchThemePreference().rawValue
+ report["lastQuickSwitchOpenRequestSource"] = lastQuickSwitchOpenRequestSource
+ report["authorization"] = round015EntitlementOptions.authorizationReportDictionary()
report["aboutVersion"] = versionBuild.version
report["aboutBuild"] = versionBuild.build
report["statusMenu"] = statusMenuReportDictionary()
@@ -702,7 +734,11 @@
return DebugWindowActivationService()
}
- return CGWindowAXWindowService(spaceIDsByWindowIDProvider: { _ in [:] })
+ let context = quickSwitchWindowSpaceContext()
+ return CGWindowAXWindowService(
+ spaceIDsByWindowIDProvider: context.spaceIDsByWindowIDProvider,
+ fullscreenSpaceIDs: context.fullscreenSpaceIDs
+ )
}
private func quickSwitchWaterfallViewMode() -> QuickSwitchWaterfallViewMode {
@@ -728,7 +764,39 @@
return DebugWindowCloseService()
}
- return CGWindowAXWindowService(spaceIDsByWindowIDProvider: { _ in [:] })
+ let context = quickSwitchWindowSpaceContext()
+ return CGWindowAXWindowService(
+ spaceIDsByWindowIDProvider: context.spaceIDsByWindowIDProvider,
+ fullscreenSpaceIDs: context.fullscreenSpaceIDs
+ )
+ }
+
+ private func quickSwitchWindowSpaceContext() -> (
+ spaceIDsByWindowIDProvider: ([UInt32]) -> [UInt32: [UInt64]],
+ fullscreenSpaceIDs: Set<UInt64>
+ ) {
+ do {
+ let spaceEnumerator = try SkyLightSpaceEnumerator()
+ let displays = try spaceEnumerator.displays()
+ let fullscreenSpaceIDs = Set(
+ displays
+ .flatMap(\.spaces)
+ .filter { $0.type == .fullscreen }
+ .map(\.id)
+ )
+ return (
+ spaceIDsByWindowIDProvider: spaceEnumerator.spaceIDsByWindowID(windowIDs:),
+ fullscreenSpaceIDs: fullscreenSpaceIDs
+ )
+ } catch {
+ DevelopmentDiagnostics.log("app.quickSwitch.windowSpaceContextUnavailable", [
+ "error": DevelopmentDiagnostics.errorSummaryString(error)
+ ])
+ return (
+ spaceIDsByWindowIDProvider: { _ in [:] },
+ fullscreenSpaceIDs: []
+ )
+ }
}
private var quickSwitchConfirmBeforeClose: Bool {
--
Gitblit v1.9.3