From a465f1f6f733940df3d28550b2af45296ad644b8 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Thu, 04 Jun 2026 18:56:17 +0800
Subject: [PATCH] Add blurred quick switch backdrop
---
C1.source/Sources/Aligner/QuickSwitchRootView.swift | 43 +++++++++++++++++++++++++++++++++++--------
C1.source/Resources/Aligner-Info.plist | 4 ++--
2 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/C1.source/Resources/Aligner-Info.plist b/C1.source/Resources/Aligner-Info.plist
index 5c82ff7..1c6dda1 100644
--- a/C1.source/Resources/Aligner-Info.plist
+++ b/C1.source/Resources/Aligner-Info.plist
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>0.0.24</string>
+ <string>0.0.25</string>
<key>CFBundleVersion</key>
- <string>20260604.1736</string>
+ <string>20260604.1854</string>
<key>LSMinimumSystemVersion</key>
<string>26.0</string>
<key>NSHighResolutionCapable</key>
diff --git a/C1.source/Sources/Aligner/QuickSwitchRootView.swift b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
index 41973d4..f179043 100644
--- a/C1.source/Sources/Aligner/QuickSwitchRootView.swift
+++ b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
@@ -9,6 +9,8 @@
@MainActor
final class QuickSwitchRootView: NSView {
+ private let backdropBlurView = NSVisualEffectView()
+ private let layerHostView = NSView()
private let backgroundLayer = CAGradientLayer()
private let safeAreaFillLayer = CALayer()
private let glassLayer = CALayer()
@@ -152,12 +154,16 @@
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
+ setupBackdropBlurView()
+ setupLayerHostView()
wantsLayer = true
setupLayers()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
+ setupBackdropBlurView()
+ setupLayerHostView()
wantsLayer = true
setupLayers()
}
@@ -185,6 +191,8 @@
override func layout() {
super.layout()
+ backdropBlurView.frame = bounds
+ layerHostView.frame = bounds
layoutLayers()
}
@@ -1176,13 +1184,32 @@
value ?? NSNull()
}
+ private func setupBackdropBlurView() {
+ backdropBlurView.material = .fullScreenUI
+ backdropBlurView.blendingMode = .behindWindow
+ backdropBlurView.state = .active
+ backdropBlurView.isEmphasized = false
+ backdropBlurView.frame = bounds
+ backdropBlurView.autoresizingMask = [.width, .height]
+ addSubview(backdropBlurView, positioned: .below, relativeTo: nil)
+ }
+
+ private func setupLayerHostView() {
+ layerHostView.wantsLayer = true
+ layerHostView.frame = bounds
+ layerHostView.autoresizingMask = [.width, .height]
+ layerHostView.layer?.masksToBounds = true
+ layerHostView.layer?.backgroundColor = NSColor.clear.cgColor
+ addSubview(layerHostView, positioned: .above, relativeTo: backdropBlurView)
+ }
+
private func setupLayers() {
- guard let rootLayer = layer else { return }
+ guard let rootLayer = layerHostView.layer else { return }
rootLayer.masksToBounds = true
backgroundLayer.colors = [
- NSColor.windowBackgroundColor.withAlphaComponent(0.72).cgColor,
- NSColor.controlBackgroundColor.withAlphaComponent(0.62).cgColor
+ NSColor.windowBackgroundColor.withAlphaComponent(0.58).cgColor,
+ NSColor.controlBackgroundColor.withAlphaComponent(0.48).cgColor
]
backgroundLayer.startPoint = CGPoint(x: 0.5, y: 1.0)
backgroundLayer.endPoint = CGPoint(x: 0.5, y: 0.0)
@@ -1198,13 +1225,13 @@
glassLayer.shadowOpacity = 0
rootLayer.addSublayer(glassLayer)
- laneLayer.backgroundColor = NSColor.controlBackgroundColor.withAlphaComponent(0.50).cgColor
+ laneLayer.backgroundColor = NSColor.controlBackgroundColor.withAlphaComponent(0.68).cgColor
laneLayer.cornerRadius = 16
laneLayer.masksToBounds = true
glassLayer.addSublayer(laneLayer)
laneLayer.addSublayer(spaceLaneContentLayer)
- shelfLayer.backgroundColor = NSColor.controlBackgroundColor.withAlphaComponent(0.42).cgColor
+ shelfLayer.backgroundColor = NSColor.controlBackgroundColor.withAlphaComponent(0.60).cgColor
shelfLayer.cornerRadius = 16
shelfLayer.masksToBounds = true
glassLayer.addSublayer(shelfLayer)
@@ -1296,12 +1323,12 @@
container.name = column.app.name
container.cornerRadius = 14
container.masksToBounds = true
- container.backgroundColor = NSColor.controlBackgroundColor.withAlphaComponent(0.34).cgColor
- container.borderColor = NSColor.separatorColor.withAlphaComponent(0.28).cgColor
+ container.backgroundColor = NSColor.controlBackgroundColor.withAlphaComponent(0.56).cgColor
+ container.borderColor = NSColor.separatorColor.withAlphaComponent(0.34).cgColor
container.borderWidth = 1
let header = CALayer()
- header.backgroundColor = NSColor.controlBackgroundColor.withAlphaComponent(0.58).cgColor
+ header.backgroundColor = NSColor.controlBackgroundColor.withAlphaComponent(0.68).cgColor
let appName = makeTextLayer(
string: column.app.name,
--
Gitblit v1.9.3