aboutsummaryrefslogtreecommitdiff
path: root/Flat Bezel/BackgroundView.swift
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-09-04 11:11:37 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-09-04 11:11:37 +0200
commitbb5daa2e90623691a5259700b9d388d2d21f46d3 (patch)
treef5629e81bedc6cdd35ee9a79628997c5e14ffa7c /Flat Bezel/BackgroundView.swift
parent3dfeb86c5c3b72acc59919c7a198fcf76a54c35c (diff)
Rename to Liquid Glass Bezel, add preferences
Diffstat (limited to 'Flat Bezel/BackgroundView.swift')
-rw-r--r--Flat Bezel/BackgroundView.swift88
1 files changed, 0 insertions, 88 deletions
diff --git a/Flat Bezel/BackgroundView.swift b/Flat Bezel/BackgroundView.swift
deleted file mode 100644
index e5f4c86..0000000
--- a/Flat Bezel/BackgroundView.swift
+++ /dev/null
@@ -1,88 +0,0 @@
-import Foundation
-import Cocoa
-
-
-class BackgroundView: QSBezelBackgroundView {
-
- private var glassView: NSGlassEffectView?
-
- override func awakeFromNib() {
- super.awakeFromNib()
- configureParentView()
- setupGlassEffect()
- }
-
- override init(frame frameRect: NSRect) {
- super.init(frame: frameRect)
- configureParentView()
- setupGlassEffect()
- }
-
- required init?(coder: NSCoder) {
- super.init(coder: coder)
- configureParentView()
- setupGlassEffect()
- }
-
- private func configureParentView() {
- // Make the parent background much more transparent so glass effect shows through
- setColor(NSColor.clear) // Try completely transparent first
- setIsGlass(NSNumber(value: false)) // Disable the parent's glass rendering
-
- // Alternative: if clear doesn't work, try a very transparent background
- // setColor(NSColor.black.withAlphaComponent(0.1))
- }
-
- private func setupGlassEffect() {
- let glassView = NSGlassEffectView(frame: bounds)
- glassView.autoresizingMask = [.width, .height]
- glassView.cornerRadius = 12.0
- glassView.style = .clear
-
- // Create a content view for the glass effect
- let contentView = NSView(frame: glassView.bounds)
- contentView.autoresizingMask = [.width, .height]
- glassView.contentView = contentView
-
- // Add subtle tint based on appearance
- updateGlassTint()
-
- // Insert the glass view at the bottom of the view hierarchy
- addSubview(glassView, positioned: .below, relativeTo: nil)
- self.glassView = glassView
- }
-
- private func updateGlassTint() {
- guard let glassView = glassView else { return }
-
- let darkMode = effectiveAppearance.name == .darkAqua
- if darkMode {
- // Very subtle tint for dark mode to maintain translucency
- glassView.tintColor = NSColor.black.withAlphaComponent(0.05)
- } else {
- // Even lighter tint for light mode
- glassView.tintColor = NSColor.white.withAlphaComponent(0.02)
- }
- }
-
- override func viewDidMoveToWindow() {
- super.viewDidMoveToWindow()
-
- // Ensure the window is configured for transparency
- if let window = self.window {
- window.backgroundColor = NSColor.clear
- window.isOpaque = false
- }
- }
-
- override func draw(_ rect: NSRect) {
- // Don't call super.draw(rect) to avoid the parent's opaque background
- // The glass effect will handle the visual appearance
- return
- }
-
- override func viewDidChangeEffectiveAppearance() {
- super.viewDidChangeEffectiveAppearance()
- updateGlassTint()
- }
-}