Update LiquidGlassBackground to remove polling

This commit is contained in:
Hariharan Mudaliar 2026-02-22 13:34:03 +05:30
commit 1d6cdf866a
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
8 changed files with 145 additions and 59 deletions

View file

@ -4520,7 +4520,6 @@ private struct LockScreenGlassVariantPreviewCell: View {
private let cornerRadius: CGFloat = 16
private let previewCornerRadius: CGFloat = 14
private let previewSize = CGSize(width: 190, height: 96)
@State private var previewToken: Double = 0
var body: some View {
ZStack {
@ -4549,7 +4548,6 @@ private struct LockScreenGlassVariantPreviewCell: View {
Logger.log("Lock screen glass preview disappeared", category: .performance)
}
.onChange(of: variant) { _, newValue in
previewToken = Date().timeIntervalSinceReferenceDate
Logger.log("Lock screen glass preview variant changed to v\(newValue.rawValue)", category: .performance)
}
}
@ -4557,9 +4555,7 @@ private struct LockScreenGlassVariantPreviewCell: View {
private var liquidGlassPreview: some View {
LiquidGlassBackground(
variant: variant,
cornerRadius: previewCornerRadius,
trigger: previewToken,
jitterEnabled: false
cornerRadius: previewCornerRadius
) {
Color.white.opacity(0.04)
}

View file

@ -59,9 +59,10 @@ class SettingsWindowController: NSWindowController {
window.titleVisibility = .visible
window.toolbarStyle = .unified
window.isMovableByWindowBackground = true
window.level = .normal
// Make it behave like a regular app window with proper Spaces support
window.collectionBehavior = [.managed, .participatesInCycle, .fullScreenAuxiliary]
window.collectionBehavior = [.managed, .participatesInCycle]
// Ensure proper window behavior
window.hidesOnDeactivate = false
@ -85,6 +86,10 @@ class SettingsWindowController: NSWindowController {
func showWindow() {
// Ensure window exists
_ = window
// Reassert regular window semantics in case any prior state mutated this window.
window?.level = .normal
window?.collectionBehavior = [.managed, .participatesInCycle]
// If window is already visible, bring it to front properly
if window?.isVisible == true {