Fix blank window with NSGlassEffectView on macOS 26

Avoid Auto Layout reparenting of SwiftUI hosting view when applying glass; force HFS+ DMG so volume name mounts as cmuxterm.
This commit is contained in:
Lawrence Chen 2026-02-08 15:59:38 -08:00
parent 0fca79e7dd
commit c1d0610a2d
2 changed files with 8 additions and 11 deletions

View file

@ -161,7 +161,9 @@ jobs:
STAGING_DIR="$(mktemp -d)"
cp -R "$APP_PATH" "$STAGING_DIR/cmuxterm.app"
ln -s /Applications "$STAGING_DIR/Applications"
hdiutil create -volname "cmuxterm" -srcfolder "$STAGING_DIR" -ov -format UDZO "$DMG_RELEASE"
# hdiutil defaults to APFS for -srcfolder images (volume name becomes "Untitled" on mount).
# Force HFS+ so the mounted volume name is stable and Finder shows the contents reliably.
hdiutil create -fs HFS+ -volname "cmuxterm" -srcfolder "$STAGING_DIR" -ov -format UDZO "$DMG_RELEASE"
rm -rf "$STAGING_DIR"
DMG_SUBMIT_JSON="$(xcrun notarytool submit "$DMG_RELEASE" --apple-id "$APPLE_ID" --team-id "$APPLE_TEAM_ID" --password "$APPLE_APP_SPECIFIC_PASSWORD" --wait --output-format json)"
DMG_SUBMIT_ID="$(python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])' <<<"$DMG_SUBMIT_JSON")"

View file

@ -23,7 +23,9 @@ enum WindowGlassEffect {
let bounds = contentView.bounds
// macOS 26+: Use NSGlassEffectView as the new contentView (full replacement is safe)
// macOS 26+: Prefer NSGlassEffectView. Avoid re-parenting the SwiftUI NSHostingView via
// constraints (it can result in a blank content area). Keep the original content view
// on autoresizing masks and just insert it into the glass view.
if let glassClass = NSClassFromString("NSGlassEffectView") as? NSVisualEffectView.Type {
let glassView = glassClass.init(frame: bounds)
glassView.wantsLayer = true
@ -37,21 +39,14 @@ enum WindowGlassEffect {
}
}
// Replace contentView safe on macOS 26+ where traffic lights composite above
window.contentView = glassView
contentView.translatesAutoresizingMaskIntoConstraints = false
contentView.wantsLayer = true
contentView.layer?.backgroundColor = NSColor.clear.cgColor
contentView.frame = glassView.bounds
contentView.autoresizingMask = [.width, .height]
glassView.addSubview(contentView)
NSLayoutConstraint.activate([
contentView.topAnchor.constraint(equalTo: glassView.topAnchor),
contentView.bottomAnchor.constraint(equalTo: glassView.bottomAnchor),
contentView.leadingAnchor.constraint(equalTo: glassView.leadingAnchor),
contentView.trailingAnchor.constraint(equalTo: glassView.trailingAnchor)
])
objc_setAssociatedObject(window, &glassViewKey, glassView, .OBJC_ASSOCIATION_RETAIN)
return
}