From 01fe6666d68d8bc1e55e314ccbe0f7328cbe16d3 Mon Sep 17 00:00:00 2001 From: Wells Riley <884715+wr@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:56:53 -0400 Subject: [PATCH] W-990: render the picker glass with public API only 1.10.0 copied NSPopover's frostier glass by setting NSGlassEffectView's private _variant to 20. macOS 27.2 renumbered those variants, so 20 now renders a clear lens: the panel goes see-through, its edge columns, search field and tab bar refract out of view, and the corners frost into wedges. On 27.0, variant 19 reproduces the reporter's screenshot exactly. The responds(to:) guard only covered the key disappearing, not this. Light mode now uses the public .clear style under the existing 0.25 white veil. On 27.0 that measures the same as the shipped look (~247 over white, ~117 over black) and blurs text behind it just as heavily. Dark mode stays on unveiled .regular glass, as before. Refs: W-990 --- Sources/Mojito/Util/PopoverGlass.swift | 28 +++++++++----------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/Sources/Mojito/Util/PopoverGlass.swift b/Sources/Mojito/Util/PopoverGlass.swift index 099756e..15f22c4 100644 --- a/Sources/Mojito/Util/PopoverGlass.swift +++ b/Sources/Mojito/Util/PopoverGlass.swift @@ -1,20 +1,18 @@ import AppKit import SwiftUI -/// The system emoji picker's Liquid Glass, for our borderless panels. A bare -/// `NSGlassEffectView` renders the clearer regular glass, which reads as a -/// flat grey slab over light content. NSPopover hosts the same view with the -/// private `_variant` 20, which is frostier. +/// The system emoji picker's Liquid Glass, for our borderless panels, from +/// public API only. NSPopover gets its look from a private glass variant, +/// but those are numbered, and macOS 27.2 renumbered them: the number we +/// once borrowed now renders a clear lens that hides the panel's edges. /// -/// Even variant 20 sits darker than the system picker, which reads ~239 -/// over light content and ~115 over black, where bare glass gives ~232 and -/// 71. A 0.25 white veil lands on both; a heavier one turns the panel into -/// a light slab over dark backdrops and hides what's behind it. +/// Light mode is clear glass under a 0.25 white veil, which reads like the +/// system picker (~247 over white, ~117 over black). Regular glass reads +/// greyer over white and lifts dark backdrops into a light slab. /// /// Dark mode keeps the regular glass, unveiled. Over a bright backdrop -/// variant 20 turns light grey while the content stays dark-scheme, leaving -/// white text on light grey (NSPopover has the same problem; our rows are -/// text, so it matters more here). +/// clear glass turns light grey while the content stays dark-scheme, +/// leaving white text on light grey. @available(macOS 26.0, *) enum PopoverGlass { private static let lightVeil = NSColor.white.withAlphaComponent(0.25).cgColor @@ -41,15 +39,9 @@ enum PopoverGlass { /// Call whenever the panel's appearance is (re)set. static func match(_ glass: NSGlassEffectView, to appearance: NSAppearance) { - // Assigning `style` rewrites the private variant, even when the - // style is unchanged — that's what undoes a previous light-mode pass. - glass.style = .regular let isDark = appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua + glass.style = isDark ? .regular : .clear glass.contentView?.layer?.backgroundColor = isDark ? nil : lightVeil - // KVC on a missing key raises, so if a future macOS drops the key - // this degrades to the regular glass. - guard !isDark, glass.responds(to: NSSelectorFromString("set_variant:")) else { return } - glass.setValue(20, forKey: "_variant") } }