From 5c054407508d90811f2498522d4511c520b10c4c Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 06 Jun 2026 23:05:23 +0800
Subject: [PATCH] fix: 仅实时 hover Space Lane 时才对对应窗口应用 spaceFocused 高亮 (v0.0.31)
---
C1.source/Sources/AlignerCore/Windows/QuickSwitchViewModel.swift | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/C1.source/Sources/AlignerCore/Windows/QuickSwitchViewModel.swift b/C1.source/Sources/AlignerCore/Windows/QuickSwitchViewModel.swift
index 49adc7b..1686294 100644
--- a/C1.source/Sources/AlignerCore/Windows/QuickSwitchViewModel.swift
+++ b/C1.source/Sources/AlignerCore/Windows/QuickSwitchViewModel.swift
@@ -208,8 +208,11 @@
appCountsBySpace: [UInt64: Int],
appNamesBySpace: [UInt64: [String]]
) -> [QuickSwitchDisplayViewModel] {
- displays
+ let sortedDisplays = displays
.sorted { $0.uuid.localizedStandardCompare($1.uuid) == .orderedAscending }
+ let displayCount = sortedDisplays.count
+
+ return sortedDisplays
.enumerated()
.map { displayIndex, display in
let displayLabel = displayLabel(for: displayIndex)
@@ -220,7 +223,7 @@
id: space.id,
displayUUID: space.displayUUID,
index: space.index,
- label: "\(displayLabel)\(space.index)",
+ label: spaceLabel(for: space, displayIndex: displayIndex, displayCount: displayCount),
type: space.type,
isCurrent: currentSpaceIDs.contains(space.id),
windowCount: windowCountsBySpace[space.id] ?? 0,
@@ -256,14 +259,13 @@
private static func labelsBySpaceID(from displays: [AlignerDisplay]) -> [UInt64: String] {
var labels: [UInt64: String] = [:]
-
- for (displayIndex, display) in displays
+ let sortedDisplays = displays
.sorted(by: { $0.uuid.localizedStandardCompare($1.uuid) == .orderedAscending })
- .enumerated()
- {
- let displayLabel = displayLabel(for: displayIndex)
+ let displayCount = sortedDisplays.count
+
+ for (displayIndex, display) in sortedDisplays.enumerated() {
for space in display.spaces {
- labels[space.id] = "\(displayLabel)\(space.index)"
+ labels[space.id] = spaceLabel(for: space, displayIndex: displayIndex, displayCount: displayCount)
}
}
@@ -328,4 +330,12 @@
return String(String.UnicodeScalarView(scalars))
}
+
+ private static func spaceLabel(for space: AlignerSpace, displayIndex: Int, displayCount: Int) -> String {
+ if displayCount <= 1 {
+ return String(format: "%02d", space.index)
+ }
+
+ return "\(displayLabel(for: displayIndex))\(space.index)"
+ }
}
--
Gitblit v1.9.3