2022-06-25 12:19:59 +02:00
|
|
|
#if defined(OS_MACOS)
|
|
|
|
|
|
|
|
#include <CoreFoundation/CFBundle.h>
|
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
2022-06-30 15:28:51 +02:00
|
|
|
#include <Foundation/NSUserDefaults.h>
|
2022-06-30 15:20:13 +02:00
|
|
|
#include <Foundation/Foundation.h>
|
2023-02-08 13:51:56 +01:00
|
|
|
#include <AppKit/NSScreen.h>
|
2022-06-25 12:19:59 +02:00
|
|
|
|
|
|
|
#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);
|
|
|
|
}
|
|
|
|
|
2023-01-04 14:55:58 +01:00
|
|
|
bool isMacosSystemDarkModeEnabled(void) {
|
2022-06-30 15:09:57 +02:00
|
|
|
NSString * appleInterfaceStyle = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
|
|
|
|
|
|
|
|
if (appleInterfaceStyle && [appleInterfaceStyle length] > 0) {
|
|
|
|
return [[appleInterfaceStyle lowercaseString] containsString:@"dark"];
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-08 14:11:42 +01:00
|
|
|
float getBackingScaleFactor(void) {
|
2023-02-08 13:51:56 +01:00
|
|
|
return [[NSScreen mainScreen] backingScaleFactor];
|
|
|
|
}
|
|
|
|
|
2023-01-04 14:55:58 +01:00
|
|
|
#endif
|