From 23f55569beda4ed53e4d85a12769ef41f05f96ca Mon Sep 17 00:00:00 2001 From: Akemi Date: Sat, 3 Nov 2018 11:58:18 +0100 Subject: cocoa-cb: add support for mac 10.14 Dark mode and run time switching setting the appearance of the window to nil will always use the system setting and changes on run time switches too. this is only the case for macOS 10.14. --- video/out/cocoa-cb/title_bar.swift | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/video/out/cocoa-cb/title_bar.swift b/video/out/cocoa-cb/title_bar.swift index fbd4ec0776..fc8c208485 100644 --- a/video/out/cocoa-cb/title_bar.swift +++ b/video/out/cocoa-cb/title_bar.swift @@ -93,12 +93,17 @@ class TitleBar: NSVisualEffectView { effect = style as! String } - if effect == "auto" { - let systemStyle = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") - effect = systemStyle == nil ? "mediumlight" : "ultradark" - } - switch effect { + case "auto": + if #available(macOS 10.14, *) { + cocoaCB.window.appearance = nil + material = .titlebar + state = .followsWindowActiveState + } else { + let systemStyle = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") + effect = systemStyle == nil ? "mediumlight" : "ultradark" + setStyle(effect) + } case "mediumlight": cocoaCB.window.appearance = NSAppearance(named: NSAppearanceNameVibrantLight) material = .titlebar -- cgit v1.2.3