Skip to content

Commit c088e67

Browse files
committed
feat: add global liquid glass preference
1 parent 50b0114 commit c088e67

13 files changed

Lines changed: 51 additions & 20 deletions

‎EdgeMark/Core/Settings/AppSettings.swift‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,20 @@ final class AppSettings {
192192
didSet { UserDefaults.standard.set(panelStyle.rawValue, forKey: "panelStyle") }
193193
}
194194

195+
/// Whether supported systems use Liquid Glass for controls and transient surfaces.
196+
/// Defaults on; disabling it restores EdgeMark's classic material and hover styling.
197+
var liquidGlassEnabled: Bool = true {
198+
didSet { UserDefaults.standard.set(liquidGlassEnabled, forKey: "liquidGlassEnabled") }
199+
}
200+
201+
var usesLiquidGlass: Bool {
202+
if #available(macOS 26.0, *) {
203+
liquidGlassEnabled
204+
} else {
205+
false
206+
}
207+
}
208+
195209
// MARK: - Spell checking
196210

197211
/// Mirrors `SpellCheckingPolicy.continuousSpellChecking`.
@@ -303,6 +317,7 @@ final class AppSettings {
303317
{
304318
panelStyle = value
305319
}
320+
liquidGlassEnabled = UserDefaults.standard.object(forKey: "liquidGlassEnabled") as? Bool ?? true
306321
// If the saved font is no longer installed (e.g. user uninstalled it),
307322
// drop it silently so the editor falls back to the system font.
308323
if let saved = UserDefaults.standard.string(forKey: "editorFontName"),

‎EdgeMark/Resources/Locales/de.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"settings.appearance.system": "System",
133133
"settings.appearance.light": "Hell",
134134
"settings.appearance.dark": "Dunkel",
135+
"settings.general.liquidGlass": "Liquid Glass verwenden",
135136

136137
"settings.general.panelTint": "Panel-Tönung",
137138
"settings.editor.section": "Editor",

‎EdgeMark/Resources/Locales/en.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"settings.appearance.system": "System",
133133
"settings.appearance.light": "Light",
134134
"settings.appearance.dark": "Dark",
135+
"settings.general.liquidGlass": "Use Liquid Glass",
135136

136137
"settings.general.panelTint": "Panel tint",
137138
"settings.editor.section": "Editor",

‎EdgeMark/Resources/Locales/es.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"settings.appearance.system": "Sistema",
133133
"settings.appearance.light": "Claro",
134134
"settings.appearance.dark": "Oscuro",
135+
"settings.general.liquidGlass": "Usar Liquid Glass",
135136

136137
"settings.general.panelTint": "Tinte del panel",
137138
"settings.editor.section": "Editor",

‎EdgeMark/Resources/Locales/hi.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"settings.appearance.system": "सिस्टम",
133133
"settings.appearance.light": "लाइट",
134134
"settings.appearance.dark": "डार्क",
135+
"settings.general.liquidGlass": "Liquid Glass का उपयोग करें",
135136

136137
"settings.general.panelTint": "पैनल टिंट",
137138
"settings.editor.section": "एडिटर",

‎EdgeMark/Resources/Locales/zh-Hans.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"settings.appearance.system": "跟随系统",
133133
"settings.appearance.light": "浅色",
134134
"settings.appearance.dark": "深色",
135+
"settings.general.liquidGlass": "使用液态玻璃",
135136

136137
"settings.general.panelTint": "面板色调",
137138
"settings.editor.section": "编辑器",

‎EdgeMark/UI/Components/AppKitGlassSurface.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class AppKitGlassSurface: NSView {
2424
contentView.frame = bounds
2525
contentView.autoresizingMask = [.width, .height]
2626

27-
if #available(macOS 26.0, *) {
27+
if #available(macOS 26.0, *), AppSettings.shared.usesLiquidGlass {
2828
let glassView = NSGlassEffectView(frame: bounds)
2929
glassView.autoresizingMask = [.width, .height]
3030
glassView.cornerRadius = cornerRadius

‎EdgeMark/UI/Components/ClipboardFeedbackView.swift‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import SwiftUI
22

33
struct ClipboardFeedbackView: View {
4+
@Environment(AppSettings.self) private var appSettings
45
@Environment(L10n.self) private var l10n
56

67
let count: Int
@@ -10,7 +11,7 @@ struct ClipboardFeedbackView: View {
1011
}
1112

1213
var body: some View {
13-
if #available(macOS 26.0, *) {
14+
if #available(macOS 26.0, *), appSettings.usesLiquidGlass {
1415
feedbackLabel
1516
.glassEffect(.regular, in: Capsule())
1617
} else {

‎EdgeMark/UI/Components/FindBarView.swift‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct FindBarView: View {
2727
@FocusState private var isSearchFocused: Bool
2828

2929
@Environment(L10n.self) private var l10n
30+
@Environment(AppSettings.self) private var appSettings
3031

3132
// MARK: - Body
3233

@@ -72,7 +73,7 @@ struct FindBarView: View {
7273
Divider().frame(height: 14)
7374

7475
GlassControlGroup {
75-
HStack(spacing: 0) {
76+
HStack(spacing: appSettings.usesLiquidGlass ? 0 : 6) {
7677
AdaptiveIconButton(
7778
systemName: "chevron.up",
7879
help: "Previous match (⇧↩)",
@@ -151,7 +152,7 @@ struct FindBarView: View {
151152

152153
@ViewBuilder
153154
private var caseSensitivityButton: some View {
154-
if #available(macOS 26.0, *) {
155+
if #available(macOS 26.0, *), appSettings.usesLiquidGlass {
155156
Button {
156157
caseSensitive.toggle()
157158
} label: {
@@ -167,7 +168,7 @@ struct FindBarView: View {
167168
} label: {
168169
caseSensitivityLabel
169170
.background {
170-
ButtonBorderShape.roundedRectangle
171+
RoundedRectangle(cornerRadius: SurfaceMetrics.classicControlCornerRadius)
171172
.fill(Color.primary.opacity(caseSensitive ? 0.12 : 0))
172173
}
173174
}

‎EdgeMark/UI/Components/GlassControlGroup.swift‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ extension EnvironmentValues {
77
/// Coordinates nearby Liquid Glass controls on supported systems while
88
/// preserving the same ordinary SwiftUI layout on older macOS releases.
99
struct GlassControlGroup<Content: View>: View {
10+
@Environment(AppSettings.self) private var appSettings
11+
1012
private let spacing: CGFloat?
1113
private let content: Content
1214

@@ -19,38 +21,36 @@ struct GlassControlGroup<Content: View>: View {
1921
}
2022

2123
var body: some View {
22-
if #available(macOS 26.0, *) {
24+
if #available(macOS 26.0, *), appSettings.usesLiquidGlass {
2325
GlassEffectContainer(spacing: spacing) {
2426
content
2527
}
2628
.buttonBorderShape(.roundedRectangle)
2729
} else {
28-
content.buttonBorderShape(.roundedRectangle)
30+
content
2931
}
3032
}
3133
}
3234

3335
/// Presents related panel toolbar actions as one Finder-style control island.
3436
struct PanelToolbarGroup<Content: View>: View {
37+
@Environment(AppSettings.self) private var appSettings
38+
3539
private let content: Content
3640

3741
init(@ViewBuilder content: () -> Content) {
3842
self.content = content()
3943
}
4044

4145
var body: some View {
42-
if #available(macOS 26.0, *) {
46+
if #available(macOS 26.0, *), appSettings.usesLiquidGlass {
4347
groupContent
4448
.glassEffect(.regular.interactive(), in: ButtonBorderShape.roundedRectangle)
4549
.clipShape(ButtonBorderShape.roundedRectangle)
4650
} else {
47-
groupContent
48-
.background(.regularMaterial, in: ButtonBorderShape.roundedRectangle)
49-
.overlay {
50-
ButtonBorderShape.roundedRectangle
51-
.strokeBorder(.separator.opacity(0.45), lineWidth: 0.5)
52-
}
53-
.clipShape(ButtonBorderShape.roundedRectangle)
51+
HStack(spacing: SurfaceMetrics.controlGroupSpacing) {
52+
content
53+
}
5454
}
5555
}
5656

0 commit comments

Comments
 (0)