1
0
mirror of synced 2024-12-05 20:47:57 +01:00
ImHex/lib/libimhex/source/helpers/utils_macos.m
2022-06-30 15:33:21 +02:00

28 lines
889 B
Objective-C

#if defined(OS_MACOS)
#include <CoreFoundation/CFBundle.h>
#include <ApplicationServices/ApplicationServices.h>
#include <Foundation/NSUserDefaults.h>
#include <Foundation/Foundation.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
void openWebpageMacos(const char *url) {
CFURLRef urlRef = CFURLCreateWithBytes(NULL, (uint8_t*)(url), strlen(url), kCFStringEncodingASCII, NULL);
LSOpenCFURLRef(urlRef, NULL);
CFRelease(urlRef);
}
bool isMacosSystemDarkModeEnabled() {
NSString * appleInterfaceStyle = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
if (appleInterfaceStyle && [appleInterfaceStyle length] > 0) {
return [[appleInterfaceStyle lowercaseString] containsString:@"dark"];
} else {
return false;
}
}
#endif