mirror of
https://github.com/munki/munki.git
synced 2026-01-05 22:20:00 -06:00
Don't react to psuedo Dark Mode on pre-Mojave unless AllowDarkModeOnUnsupportedOSes pref is set
This commit is contained in:
@@ -75,13 +75,13 @@ class MSCAppDelegate(NSObject):
|
||||
# without the Retina assets to avoid an appearance issue when the
|
||||
# icon has a badge in the Dock (and App Switcher)
|
||||
# Darwin major version 10 is Snow Leopard (10.6)
|
||||
if os.uname()[2].split('.')[0] == '10':
|
||||
if int(os.uname()[2].split('.')[0]) == 10:
|
||||
myImage = NSImage.imageNamed_("Managed Software Center 10_6")
|
||||
NSApp.setApplicationIconImage_(myImage)
|
||||
|
||||
# if we are running under Mountain Lion or later set ourselves as a delegate
|
||||
# for NSUserNotificationCenter notifications
|
||||
if os.uname()[2].split('.')[0] > '11':
|
||||
if int(os.uname()[2].split('.')[0]) > 11:
|
||||
NSUserNotificationCenter.defaultUserNotificationCenter().setDelegate_(self)
|
||||
|
||||
# have the statuscontroller register for its own notifications
|
||||
|
||||
@@ -24,9 +24,12 @@ from Foundation import NSString, NSLocalizedString, NSUTF8StringEncoding
|
||||
|
||||
def interfaceStyle():
|
||||
'''Returns "dark" if using Dark Mode, otherwise "light"'''
|
||||
interfaceType = NSUserDefaults.standardUserDefaults().stringForKey_("AppleInterfaceStyle")
|
||||
if interfaceType == "Dark":
|
||||
return "dark"
|
||||
# running under Mojave or later or undocumented pref is set
|
||||
if (int(os.uname()[2].split('.')[0]) >= 18 or
|
||||
NSUserDefaults.standardUserDefaults().boolForKey_("AllowDarkModeOnUnsupportedOSes")):
|
||||
interfaceType = NSUserDefaults.standardUserDefaults().stringForKey_("AppleInterfaceStyle")
|
||||
if interfaceType == "Dark":
|
||||
return "dark"
|
||||
return "light"
|
||||
|
||||
def quote(a_string):
|
||||
|
||||
Reference in New Issue
Block a user