Skip to content

feat: Liquid Glass effect for macOS 26 (Tahoe)#1139

Closed
bianyeyu wants to merge 1 commit into
rime:masterfrom
bianyeyu:feature/liquid-glass-effect
Closed

feat: Liquid Glass effect for macOS 26 (Tahoe)#1139
bianyeyu wants to merge 1 commit into
rime:masterfrom
bianyeyu:feature/liquid-glass-effect

Conversation

@bianyeyu

@bianyeyu bianyeyu commented Jun 8, 2026

Copy link
Copy Markdown

Summary

  • Use NSGlassEffectView as the candidate panel background on macOS 26+, falling back to NSVisualEffectView on older systems
  • Make SquirrelView's panel layer transparent in glass mode so the system Liquid Glass material shows through
  • Fully backward compatible: gated behind #available(macOS 26.0, *) and theme.translucency

Changes

SquirrelPanel.swift:

  • Add NSGlassEffectView as window contentView on macOS 26+, with content views embedded via glass.contentView
  • Propagate frame/bounds correctly through the glass wrapper for both horizontal and vertical layouts
  • Set alphaValue = 1 in glass mode (glass manages its own transparency)

SquirrelView.swift:

  • Set panelLayer.fillColor to NSColor.clear when Liquid Glass is active, so the glass effect is visible beneath the text

How to enable

Set translucency: true in your squirrel.custom.yaml (already the default for many themes):

patch:
  style:
    translucency: true

Test plan

  • Build and run on macOS 26.5 (25F71) with Xcode 26
  • Verified Liquid Glass renders on candidate panel
  • Verified candidate selection (number keys) works correctly
  • Verified horizontal and vertical layout modes
  • Verified backward compatibility: #available guard ensures no change on macOS < 26

Screenshots

Tested on macOS 26.5 Tahoe with Liquid Glass theme. The candidate panel now uses the native system glass material, automatically adapting to content behind the window.


🤖 Generated with Claude Code

Use NSGlassEffectView as the candidate panel background on macOS 26+,
falling back to the existing NSVisualEffectView on older systems.

Changes:
- SquirrelPanel: wrap content views inside NSGlassEffectView.contentView
  when running on macOS 26, with proper frame/bounds propagation for
  both horizontal and vertical layouts
- SquirrelView: make panelLayer background transparent in glass mode so
  the system glass material shows through

The glass effect is gated behind `#available(macOS 26.0, *)` and
`theme.translucency`, ensuring full backward compatibility. Users on
older macOS versions see no change.

Tested on macOS 26.5 (25F71) with Squirrel 1.1.2.
Copilot AI review requested due to automatic review settings June 8, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds a macOS 26+ “Liquid Glass” rendering path for the candidate panel when translucency is enabled, while preserving the existing NSVisualEffectView path for older macOS versions.

Changes:

  • Use NSGlassEffectView as the panel contentView on macOS 26+ and route sizing/rotation through its inner content view.
  • Adjust background fill behavior in SquirrelView when translucency + macOS 26+ is active.
  • Update translucency/alpha handling to account for the new glass-backed rendering path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
sources/SquirrelView.swift Clears the panel fill on macOS 26+ when translucency is enabled so the glass effect can show through.
sources/SquirrelPanel.swift Introduces a macOS 26+ NSGlassEffectView content view path and updates layout/alpha behavior accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +52 to +63
if #available(macOS 26.0, *) {
let glass = NSGlassEffectView()
glass.cornerRadius = 12
glass.autoresizingMask = [.width, .height]
let innerView = NSView()
innerView.autoresizingMask = [.width, .height]
innerView.addSubview(view)
innerView.addSubview(view.textView)
glass.contentView = innerView
glassBack = glass
self.contentView = glass
} else {
Comment on lines +52 to +68
if #available(macOS 26.0, *) {
let glass = NSGlassEffectView()
glass.cornerRadius = 12
glass.autoresizingMask = [.width, .height]
let innerView = NSView()
innerView.autoresizingMask = [.width, .height]
innerView.addSubview(view)
innerView.addSubview(view.textView)
glass.contentView = innerView
glassBack = glass
self.contentView = glass
} else {
back.blendingMode = .behindWindow
back.material = .hudWindow
back.state = .active
back.wantsLayer = true
back.layer?.mask = view.shape

if #available(macOS 26.0, *) {
let glass = NSGlassEffectView()
glass.cornerRadius = 12
Comment on lines 559 to 573
if theme.translucency {
var backFrame = subviewFrame
backFrame.size.width += theme.pagingOffset
back.frame = backFrame
back.appearance = NSApp.effectiveAppearance
back.isHidden = false
if usesLiquidGlass {
if #available(macOS 26.0, *), let glass = glassBack as? NSGlassEffectView {
glass.cornerRadius = theme.cornerRadius
}
} else {
back.frame = backFrame
back.appearance = NSApp.effectiveAppearance
back.isHidden = false
}
} else {
back.isHidden = true
}
}

alphaValue = theme.alpha
alphaValue = usesLiquidGlass ? 1 : theme.alpha
Comment on lines +37 to +40
private var usesLiquidGlass: Bool {
if #available(macOS 26.0, *) { return true }
return false
}
@lotem lotem requested a review from LEOYoon-Tsaw June 8, 2026 08:46
@lotem

lotem commented Jun 8, 2026

Copy link
Copy Markdown
Member

@LEOYoon-Tsaw LEO 老師有沒有試驗過?

@LEOYoon-Tsaw

Copy link
Copy Markdown
Member

There are too much unnecessary changes in the PR. I've created another one #1141 that only makes 10 lines of change.
Closing this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants