From d5cf4d94edbe72d53fb417bf32105c2258bce924 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sun, 14 Jun 2026 16:02:13 +0800
Subject: [PATCH] Fix horizontal App hover linkage
---
C1.source/Sources/Aligner/QuickSwitchRootView.swift | 46 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/C1.source/Sources/Aligner/QuickSwitchRootView.swift b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
index c04faf7..40611ae 100644
--- a/C1.source/Sources/Aligner/QuickSwitchRootView.swift
+++ b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
@@ -3340,6 +3340,14 @@
)
}
+ private var appIconHoverLinkedAppGroupIndex: Int? {
+ if let debugHoveredAppGroupIndex {
+ return debugHoveredAppGroupIndex
+ }
+ guard case .app(let appGroupIndex) = hoverTarget else { return nil }
+ return appGroupIndex
+ }
+
private var appHoverAssociatedSpaceLabels: [String] {
guard !appHoverAssociatedSpaceIDs.isEmpty else { return [] }
return currentViewModel?.displays
@@ -3767,10 +3775,13 @@
let bounds = card.containerLayer.bounds
let isSelected = card.item.window.id == effectiveSelection?.windowID
let isHovered = card.item.window.id == hoveredWindowID
+ let isAppLinked = isHorizontalMasonryMode
+ && card.item.appGroupIndex == appIconHoverLinkedAppGroupIndex
applyWaterfallCardVisualState(
card,
selected: shouldShowSelectedVisual(isSelected: isSelected, isHovered: isHovered),
- hovered: isHovered
+ hovered: isHovered,
+ appLinked: isAppLinked
)
let outerInset: CGFloat = 0
@@ -3833,12 +3844,19 @@
)
}
- private func applyWaterfallCardVisualState(_ card: WaterfallCardLayers, selected: Bool, hovered: Bool) {
+ private func applyWaterfallCardVisualState(
+ _ card: WaterfallCardLayers,
+ selected: Bool,
+ hovered: Bool,
+ appLinked: Bool
+ ) {
let isSpaceFocused = isWaterfallCardSpaceFocused(card)
card.containerLayer.backgroundColor = (selected
? NSColor.windowBackgroundColor.withAlphaComponent(0.94)
: hovered
? accentTintedWindowBackground(fraction: 0.09, alpha: 0.95)
+ : appLinked
+ ? accentTintedWindowBackground(fraction: 0.08, alpha: 0.93)
: isSpaceFocused
? accentTintedWindowBackground(fraction: 0.10, alpha: 0.94)
: NSColor.windowBackgroundColor.withAlphaComponent(0.82)
@@ -3847,27 +3865,31 @@
? NSColor.controlAccentColor.withAlphaComponent(0.52)
: hovered
? NSColor.controlAccentColor.withAlphaComponent(0.44)
+ : appLinked
+ ? NSColor.controlAccentColor.withAlphaComponent(0.38)
: isSpaceFocused
? NSColor.controlAccentColor.withAlphaComponent(0.42)
: NSColor.separatorColor.withAlphaComponent(0.28)
).cgColor
- card.containerLayer.borderWidth = (selected || hovered || isSpaceFocused) ? 1.5 : 1
+ card.containerLayer.borderWidth = (selected || hovered || appLinked || isSpaceFocused) ? 1.5 : 1
card.containerLayer.shadowColor = NSColor.black.cgColor
- card.containerLayer.shadowOpacity = selected ? 0.24 : hovered ? 0.14 : isSpaceFocused ? 0.20 : 0
- card.containerLayer.shadowRadius = selected ? 22 : hovered ? 17 : isSpaceFocused ? 24 : 0
+ card.containerLayer.shadowOpacity = selected ? 0.24 : hovered ? 0.14 : appLinked ? 0.16 : isSpaceFocused ? 0.20 : 0
+ card.containerLayer.shadowRadius = selected ? 22 : hovered ? 17 : appLinked ? 18 : isSpaceFocused ? 24 : 0
card.containerLayer.shadowOffset = selected
? CGSize(width: 0, height: -6)
: hovered
? CGSize(width: 0, height: -2.5)
+ : appLinked
+ ? CGSize(width: 0, height: -3)
: isSpaceFocused
? CGSize(width: 0, height: -5)
: .zero
- card.containerLayer.zPosition = selected ? 20 : hovered ? 10 : isSpaceFocused ? 8 : 0
+ card.containerLayer.zPosition = selected ? 20 : hovered ? 12 : appLinked ? 10 : isSpaceFocused ? 8 : 0
let focusedScale: CGFloat = selected ? 1.015 : isSpaceFocused ? 1.012 : 1.008
card.containerLayer.transform = (selected || hovered || isSpaceFocused)
? CATransform3DMakeScale(focusedScale, focusedScale, 1)
: CATransform3DIdentity
- card.containerLayer.shadowPath = (selected || hovered || isSpaceFocused)
+ card.containerLayer.shadowPath = (selected || hovered || appLinked || isSpaceFocused)
? CGPath(
roundedRect: card.containerLayer.bounds,
cornerWidth: card.containerLayer.cornerRadius,
@@ -3875,7 +3897,9 @@
transform: nil
)
: nil
- card.titleBarLayer.backgroundColor = NSColor.clear.cgColor
+ card.titleBarLayer.backgroundColor = appLinked
+ ? spaceLaneOccupiedColor.withAlphaComponent(0.18).cgColor
+ : NSColor.clear.cgColor
card.titleBarLayer.borderColor = NSColor.clear.cgColor
card.titleBarLayer.borderWidth = 0
card.shineLayer.opacity = selected ? 1 : 0
@@ -5002,6 +5026,7 @@
"shadowRadius": Double(card.containerLayer.shadowRadius),
"thumbnailFrame": dictionary(from: card.thumbnailLayer.frame),
"titleBarFrame": dictionary(from: card.titleBarLayer.frame),
+ "titleBarBackgroundColor": colorDictionary(from: card.titleBarLayer.backgroundColor),
"titleBarBorderWidth": Double(card.titleBarLayer.borderWidth),
"titleFrame": dictionary(from: card.titleLayer.frame),
"metaFrame": dictionary(from: card.metaLayer.frame),
@@ -5109,6 +5134,8 @@
var states: [String] = []
let isSelected = card.item.window.id == effectiveSelection?.windowID
let isHovered = card.item.window.id == hoveredWindowID
+ let isAppLinked = isHorizontalMasonryMode
+ && card.item.appGroupIndex == appIconHoverLinkedAppGroupIndex
if shouldShowSelectedVisual(isSelected: isSelected, isHovered: isHovered) {
states.append("selected")
} else if isSelected {
@@ -5117,6 +5144,9 @@
if isHovered {
states.append("hover")
}
+ if isAppLinked {
+ states.append("appLinked")
+ }
if isWaterfallCardSpaceFocused(card) {
states.append("spaceFocused")
}
--
Gitblit v1.9.3