summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa-cb
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-11-03 11:58:18 +0100
committerJan Ekström <jeebjp@gmail.com>2019-04-02 02:09:01 +0300
commit23f55569beda4ed53e4d85a12769ef41f05f96ca (patch)
tree2ef1a5edfe63ae476b24aa98247b2faeeff058e5 /video/out/cocoa-cb
parentd5be1e272965176cb974d41fa4f6f94ada074a04 (diff)
downloadmpv-23f55569beda4ed53e4d85a12769ef41f05f96ca.tar.bz2
mpv-23f55569beda4ed53e4d85a12769ef41f05f96ca.tar.xz
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.
Diffstat (limited to 'video/out/cocoa-cb')
-rw-r--r--video/out/cocoa-cb/title_bar.swift15
1 files 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