Fix missing function definition on macOS

This commit is contained in:
Jonathan White 2019-04-12 16:08:38 -04:00
parent 2eb82c8356
commit 771ecdba12
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01

View File

@ -93,6 +93,17 @@ AppKit::~AppKit()
return [app isHidden]; return [app isHidden];
} }
//
// Get state of macOS Dark Mode color scheme
//
- (bool) isDarkMode
{
NSDictionary *dict = [[NSUserDefaults standardUserDefaults] persistentDomainForName:NSGlobalDomain];
id style = [dict objectForKey:@"AppleInterfaceStyle"];
return ( style && [style isKindOfClass:[NSString class]]
&& NSOrderedSame == [style caseInsensitiveCompare:@"dark"] );
}
// //
// ------------------------- C++ Trampolines ------------------------- // ------------------------- C++ Trampolines -------------------------
// //
@ -129,10 +140,7 @@ bool AppKit::isHidden(pid_t pid)
bool AppKit::isDarkMode() bool AppKit::isDarkMode()
{ {
NSDictionary *dict = [[NSUserDefaults standardUserDefaults] persistentDomainForName:NSGlobalDomain]; return [static_cast<id>(self) isDarkMode];
id style = [dict objectForKey:@"AppleInterfaceStyle"];
return ( style && [style isKindOfClass:[NSString class]]
&& NSOrderedSame == [style caseInsensitiveCompare:@"dark"] );
} }
@end @end