summaryrefslogtreecommitdiff
path: root/src/abaddon.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2024-03-06 00:58:01 -0500
committerouwou <26526779+ouwou@users.noreply.github.com>2024-03-06 00:58:01 -0500
commitcb6436f527f832cf74aecda2911d8e607534d8f3 (patch)
tree87366f507c2a6b56d06f360c6971d7c3d190a61d /src/abaddon.cpp
parent3c54ff85622ff7210f8acee00e075b12128567a9 (diff)
parent91e89c06958f1e058de445f9b53205e7eb341d3a (diff)
downloadabaddon-portaudio-cb6436f527f832cf74aecda2911d8e607534d8f3.tar.gz
abaddon-portaudio-cb6436f527f832cf74aecda2911d8e607534d8f3.zip
Merge branch 'master' into classic-channels
Diffstat (limited to 'src/abaddon.cpp')
-rw-r--r--src/abaddon.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/abaddon.cpp b/src/abaddon.cpp
index 443fa4e..f8c4b39 100644
--- a/src/abaddon.cpp
+++ b/src/abaddon.cpp
@@ -25,6 +25,23 @@
#include "remoteauth/remoteauthdialog.hpp"
#include "util.hpp"
+#if defined(__APPLE__)
+#include <CoreFoundation/CoreFoundation.h>
+
+void macOSThemeChanged() {
+ CFPropertyListRef appearanceName = CFPreferencesCopyAppValue(CFSTR("AppleInterfaceStyle"), kCFPreferencesAnyApplication);
+ if (appearanceName != NULL && CFGetTypeID(appearanceName) == CFStringGetTypeID() && CFStringCompare((CFStringRef)appearanceName, CFSTR("Dark"), 0) == kCFCompareEqualTo) {
+ Gtk::Settings::get_default()->set_property("gtk-application-prefer-dark-theme", true);
+ } else {
+ Gtk::Settings::get_default()->set_property("gtk-application-prefer-dark-theme", false);
+ }
+}
+
+void macOSThemeChangedCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
+ macOSThemeChanged();
+}
+#endif
+
#ifdef WITH_LIBHANDY
#include <handy.h>
#endif
@@ -36,7 +53,8 @@
Abaddon::Abaddon()
: m_settings(Platform::FindConfigFile())
, m_discord(GetSettings().UseMemoryDB) // stupid but easy
- , m_emojis(GetResPath("/emojis.bin")) {
+ , m_emojis(GetResPath("/emojis.bin"))
+ , m_audio(GetSettings().Backends) {
LoadFromSettings();
// todo: set user agent for non-client(?)
@@ -331,6 +349,17 @@ int Abaddon::StartGTK() {
m_gtk_app->hold();
m_main_window->show();
+#if defined(__APPLE__)
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(),
+ NULL,
+ macOSThemeChangedCallback,
+ CFSTR("AppleInterfaceThemeChangedNotification"),
+ NULL,
+ CFNotificationSuspensionBehaviorCoalesce);
+
+ macOSThemeChanged();
+#endif
+
RunFirstTimeDiscordStartup();
return m_gtk_app->run(*m_main_window);