From a2293c5609ee7b5b7bbfce3b4c0dc7ae365e31ff Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 13 Jun 2026 20:52:55 +0800
Subject: [PATCH] Fix Finder split view tab activation regression
---
C1.source/Sources/Aligner/QuickSwitchRootView.swift | 61 ++++++++++++++++++++++++------
1 files changed, 48 insertions(+), 13 deletions(-)
diff --git a/C1.source/Sources/Aligner/QuickSwitchRootView.swift b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
index 4ea3319..c04faf7 100644
--- a/C1.source/Sources/Aligner/QuickSwitchRootView.swift
+++ b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
@@ -1347,6 +1347,15 @@
if let card = waterfallCard(appGroupIndex: appGroupIndex, windowIndex: windowIndex) {
clickWindowCard(card)
}
+ case "click-card-id" where parts.count == 2:
+ guard let windowID = UInt32(parts[1]) else {
+ recordMouseCommand("invalid:\(command)")
+ return
+ }
+ recordMouseCommand("click-card-id:\(windowID)")
+ if let card = waterfallCard(windowID: windowID) {
+ clickWindowCard(card)
+ }
case "hover-card-close" where parts.count == 3:
guard let appGroupIndex = Int(parts[1]), let windowIndex = Int(parts[2]) else {
recordMouseCommand("invalid:\(command)")
@@ -3085,15 +3094,25 @@
.first(where: { $0.item.windowIndex == windowIndex })
}
+ private func waterfallCard(windowID: UInt32) -> WaterfallCardLayers? {
+ waterfallColumns
+ .lazy
+ .flatMap(\.cards)
+ .first(where: { $0.item.window.id == windowID })
+ }
+
private func layoutSpaceLaneSegmentContents(_ segment: SpaceLaneSegmentLayers) {
let bounds = segment.containerLayer.bounds
+ let splitAppNames = splitViewAppNames(for: segment.space)
+ let isSplitView = splitAppNames.count >= 2
segment.labelLayer.frame = CGRect(x: 10, y: bounds.height - 29, width: max(1, bounds.width - 48), height: 20)
segment.countLayer.frame = CGRect(x: bounds.width - 34, y: bounds.height - 29, width: 24, height: 20)
+ segment.countLayer.string = isSplitView ? "" : "\(segment.space.windowCount)"
+ segment.countLayer.isHidden = isSplitView
if segment.space.type == .fullscreen {
let markerFrame = fullscreenMarkerFrame(in: bounds)
- let splitAppNames = splitViewAppNames(for: segment.space)
- segment.appLayer.isHidden = splitAppNames.count >= 2
- if splitAppNames.count >= 2 {
+ segment.appLayer.isHidden = isSplitView
+ if isSplitView {
let labelY = markerFrame.midY - 8.5
let halfWidth = markerFrame.width / 2
for (index, splitAppLayer) in segment.splitAppLayers.enumerated() {
@@ -3128,7 +3147,7 @@
layoutFullscreenMarkerLayer(
fullscreenMarkerLayer,
in: bounds,
- isSplitView: splitViewAppNames(for: segment.space).count >= 2
+ isSplitView: isSplitView
)
}
@@ -4740,17 +4759,11 @@
let bounds = shapeLayer.bounds
if isSplitView {
- let insetBounds = bounds.insetBy(dx: 0.6, dy: 0.6)
- let radius = min(7, max(5, insetBounds.height * 0.22))
let path = CGMutablePath()
- path.addRoundedRect(
- in: insetBounds,
- cornerWidth: radius,
- cornerHeight: radius
- )
- path.move(to: CGPoint(x: bounds.midX, y: insetBounds.minY + 1.5))
- path.addLine(to: CGPoint(x: bounds.midX, y: insetBounds.maxY - 1.5))
+ path.move(to: CGPoint(x: bounds.midX, y: bounds.minY))
+ path.addLine(to: CGPoint(x: bounds.midX, y: bounds.maxY))
shapeLayer.path = path
+ shapeLayer.lineCap = .butt
return
}
@@ -4774,6 +4787,7 @@
path.addLine(to: CGPoint(x: 0, y: bounds.maxY - cornerLength))
shapeLayer.path = path
+ shapeLayer.lineCap = .round
}
private func fullscreenMarkerFrame(in segmentBounds: CGRect) -> CGRect {
@@ -5176,6 +5190,10 @@
markerLayer: segment.fullscreenMarkerLayer,
splitAppNames: splitAppNames
),
+ "fullscreenMarkerPathStyle": fullscreenMarkerPathStyle(
+ markerLayer: segment.fullscreenMarkerLayer,
+ splitAppNames: splitAppNames
+ ),
"fullscreenMarkerFrame": fullscreenMarkerFrame.map { dictionary(from: $0) } ?? NSNull(),
"fullscreenMarkerCenterRatio": fullscreenMarkerCenterRatio ?? NSNull(),
"splitViewAppNames": splitAppNames,
@@ -5187,6 +5205,8 @@
"windowBlockColors": segment.windowBlocks.map { colorDictionary(from: $0.backgroundColor) },
"windowBlockFrames": segment.windowBlocks.map { dictionary(from: $0.frame) },
"labelColor": colorDictionary(from: segment.labelLayer.foregroundColor),
+ "countText": string(from: segment.countLayer.string),
+ "countVisible": !segment.countLayer.isHidden && segment.countLayer.opacity > 0,
"countColor": colorDictionary(from: segment.countLayer.foregroundColor),
"appColor": colorDictionary(from: segment.appLayer.foregroundColor),
"fullscreenMarkerStrokeColor": colorDictionary(
@@ -5229,6 +5249,11 @@
private func fullscreenMarkerKind(markerLayer: CALayer?, splitAppNames: [String]) -> String {
guard markerLayer != nil else { return "none" }
return splitAppNames.count >= 2 ? "splitViewPair" : "cornerBracket"
+ }
+
+ private func fullscreenMarkerPathStyle(markerLayer: CALayer?, splitAppNames: [String]) -> String {
+ guard markerLayer != nil else { return "none" }
+ return splitAppNames.count >= 2 ? "centerDividerOnly" : "cornerBracket"
}
private func visualStates(for space: QuickSwitchSpaceViewModel) -> [String] {
@@ -5282,6 +5307,16 @@
]
}
+ private func string(from textLayerValue: Any?) -> String {
+ if let string = textLayerValue as? String {
+ return string
+ }
+ if let attributedString = textLayerValue as? NSAttributedString {
+ return attributedString.string
+ }
+ return ""
+ }
+
private func colorDictionary(from color: CGColor?) -> [String: Double] {
guard let color,
let nsColor = NSColor(cgColor: color)?.usingColorSpace(.deviceRGB)
--
Gitblit v1.9.3