0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Set macOS appearance on theme change

Makes macOS aware that we're using either light or dark theme to adjust
native dialog colors accordingly.

Co-Authored-By: Patrick Heyer <PatTheMav@users.noreply.github.com>
This commit is contained in:
gxalpha 2023-01-31 17:28:21 +01:00 committed by Patrick Heyer
parent 2272efc91f
commit 11e9291800
3 changed files with 16 additions and 0 deletions

View File

@ -1242,6 +1242,10 @@ bool OBSApp::SetTheme(std::string name, std::string path)
themeDarkMode = !(color.redF() < 0.5);
}
#ifdef __APPLE__
SetMacOSDarkMode(themeDarkMode);
#endif
emit StyleChanged();
return true;
}

View File

@ -384,6 +384,17 @@ void OpenMacOSPrivacyPreferences(const char *tab)
[[NSWorkspace sharedWorkspace] openURL:url];
}
void SetMacOSDarkMode(bool dark)
{
if (dark) {
NSApp.appearance =
[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
} else {
NSApp.appearance =
[NSAppearance appearanceNamed:NSAppearanceNameAqua];
}
}
void TaskbarOverlayInit() {}
void TaskbarOverlaySetStatus(TaskbarOverlayStatus status)
{

View File

@ -101,6 +101,7 @@ bool isInBundle();
void InstallNSApplicationSubclass();
void InstallNSThreadLocks();
void disableColorSpaceConversion(QWidget *window);
void SetMacOSDarkMode(bool dark);
MacPermissionStatus CheckPermissionWithPrompt(MacPermissionType type,
bool prompt_for_permission);