Skip background glass effect on macOS 26 to fix blank window
The transparency setup (non-opaque window + clear subview backgrounds) required for the glass effect breaks SwiftUI content rendering on macOS 26. Disable background glass when NSGlassEffectView is available until a proper macOS 26 implementation is found.
This commit is contained in:
parent
09f27d91f1
commit
082aef6a53
1 changed files with 4 additions and 5 deletions
|
|
@ -360,23 +360,22 @@ struct ContentView: View {
|
|||
window.identifier = NSUserInterfaceItemIdentifier("cmux.main")
|
||||
window.titlebarAppearsTransparent = true
|
||||
window.styleMask.insert(.fullSizeContentView)
|
||||
// For behindWindow blur to work, window must be non-opaque with transparent content view
|
||||
if sidebarBlendMode == SidebarBlendModeOption.behindWindow.rawValue && bgGlassEnabled {
|
||||
// Background glass: skip on macOS 26+ where NSGlassEffectView causes blank SwiftUI content.
|
||||
// The transparency setup (non-opaque window + clear subview backgrounds) breaks rendering.
|
||||
if sidebarBlendMode == SidebarBlendModeOption.behindWindow.rawValue && bgGlassEnabled
|
||||
&& !WindowGlassEffect.isAvailable {
|
||||
window.isOpaque = false
|
||||
window.backgroundColor = .clear
|
||||
// Configure contentView and all subviews for transparency
|
||||
if let contentView = window.contentView {
|
||||
contentView.wantsLayer = true
|
||||
contentView.layer?.backgroundColor = NSColor.clear.cgColor
|
||||
contentView.layer?.isOpaque = false
|
||||
// Make SwiftUI hosting view transparent
|
||||
for subview in contentView.subviews {
|
||||
subview.wantsLayer = true
|
||||
subview.layer?.backgroundColor = NSColor.clear.cgColor
|
||||
subview.layer?.isOpaque = false
|
||||
}
|
||||
}
|
||||
// Apply liquid glass effect to the window with tint from settings
|
||||
let tintColor = (NSColor(hex: bgGlassTintHex) ?? .black).withAlphaComponent(bgGlassTintOpacity)
|
||||
WindowGlassEffect.apply(to: window, tintColor: tintColor)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue