From ea4773d834b33d155c7c98c22914198f1447f04c Mon Sep 17 00:00:00 2001 From: weisj Date: Sun, 10 May 2020 22:16:38 +0200 Subject: [PATCH] Only patch if not already patched previously. --- macos/src/main/objcpp/DarkMode.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macos/src/main/objcpp/DarkMode.mm b/macos/src/main/objcpp/DarkMode.mm index fc115abf..b141df22 100644 --- a/macos/src/main/objcpp/DarkMode.mm +++ b/macos/src/main/objcpp/DarkMode.mm @@ -175,8 +175,10 @@ BOOL isDarkModeMojave() { CFPreferencesGetAppBooleanValue(NSRequiresAquaSystemAppearance, bundleName, &exists); isPatched = exists ? YES : NO; - CFPreferencesSetAppValue(NSRequiresAquaSystemAppearance, kCFBooleanFalse, bundleName); - CFPreferencesAppSynchronize(bundleName); + if (!isPatched) { + CFPreferencesSetAppValue(NSRequiresAquaSystemAppearance, kCFBooleanFalse, bundleName); + CFPreferencesAppSynchronize(bundleName); + } } } else { isPatched = false;