From 36f3c0bab8ff99cd32bcff81822c1b39d382e6f8 Mon Sep 17 00:00:00 2001 From: Kaede Akino Date: Wed, 23 Sep 2026 13:05:17 +0800 Subject: [PATCH] Use the native Sidebar background material --- TFM/App/RootView.swift | 24 ++++++++++++++---------- TFM/Design/DesignTokens.swift | 18 ------------------ 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/TFM/App/RootView.swift b/TFM/App/RootView.swift index b9adeb64..cde4ead8 100644 --- a/TFM/App/RootView.swift +++ b/TFM/App/RootView.swift @@ -31,16 +31,20 @@ struct RootView: View { @Bindable var presentations = window.presentations NavigationSplitView(columnVisibility: sidebarVisibility) { - ZStack { - SidebarGlassBackground() - .ignoresSafeArea() - WindowSidebarView() - } - .navigationSplitViewColumnWidth( - min: Metrics.Sidebar.min, - ideal: min(Metrics.Sidebar.ideal, sidebarMaxWidth), - max: sidebarMaxWidth - ) + WindowSidebarView() + .background { + // Modern split views supply the system sidebar material. + // An additional glass surface changes its tint and contrast. + if #unavailable(macOS 26.0) { + LegacySidebarMaterialBackground() + .ignoresSafeArea() + } + } + .navigationSplitViewColumnWidth( + min: Metrics.Sidebar.min, + ideal: min(Metrics.Sidebar.ideal, sidebarMaxWidth), + max: sidebarMaxWidth + ) } detail: { detail // Floating over the pane rather than docked under it, so switching diff --git a/TFM/Design/DesignTokens.swift b/TFM/Design/DesignTokens.swift index 10f74b56..7312e560 100644 --- a/TFM/Design/DesignTokens.swift +++ b/TFM/Design/DesignTokens.swift @@ -444,24 +444,6 @@ private struct TermindGlassBar: ViewModifier { } } -/// The Liquid Glass surface shared by every mode of the left column. -/// -/// `NavigationSplitView` supplies the column geometry, but the custom AppKit -/// lists inside it do not inherit SwiftUI's source-list background. Hosting one -/// system glass surface behind the complete column keeps list rows and empty -/// space on one coherent material, including behind the window titlebar. -struct SidebarGlassBackground: View { - @ViewBuilder - var body: some View { - if #available(macOS 26.0, *) { - Color.clear - .glassEffect(.regular, in: .rect) - } else { - LegacySidebarMaterialBackground() - } - } -} - /// Native material fallback for systems before Liquid Glass. struct LegacySidebarMaterialBackground: NSViewRepresentable { func makeNSView(context: Context) -> NSVisualEffectView {