From 1b8d342acf5e38fd7922ec7fd4cd2d8a05f5dd93 Mon Sep 17 00:00:00 2001
From: waydabber <37590873+waydabber@users.noreply.github.com>
Date: Sat, 14 Aug 2021 18:06:26 +0200
Subject: [PATCH] Handle System ColorSync profile change
---
MonitorControl/AppDelegate.swift | 7 +++----
MonitorControl/Info.plist | 2 +-
MonitorControlHelper/Info.plist | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/MonitorControl/AppDelegate.swift b/MonitorControl/AppDelegate.swift
index 88077a9..84fccae 100644
--- a/MonitorControl/AppDelegate.swift
+++ b/MonitorControl/AppDelegate.swift
@@ -252,8 +252,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
NotificationCenter.default.addObserver(self, selector: #selector(handleFriendlyNameChanged), name: .friendlyName, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handlePreferenceReset), name: .preferenceReset, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(audioDeviceChanged), name: Notification.Name.defaultOutputDeviceChanged, object: nil) // subscribe Audio output detector (SimplyCoreAudio)
- NotificationCenter.default.addObserver(self, selector: #selector(colorSyncSettingsChanged), name: NSNotification.Name(rawValue: kColorSyncDisplayDeviceProfilesNotification.takeRetainedValue() as String), object: nil) // ColorSync change
-
+ DistributedNotificationCenter.default.addObserver(self, selector: #selector(colorSyncSettingsChanged), name: NSNotification.Name(rawValue: kColorSyncDisplayDeviceProfilesNotification.takeRetainedValue() as String), object: nil) // ColorSync change
NSWorkspace.shared.notificationCenter.addObserver(self, selector: #selector(self.sleepNotification), name: NSWorkspace.screensDidSleepNotification, object: nil) // sleep and wake listeners
NSWorkspace.shared.notificationCenter.addObserver(self, selector: #selector(self.wakeNotofication), name: NSWorkspace.screensDidWakeNotification, object: nil)
NSWorkspace.shared.notificationCenter.addObserver(self, selector: #selector(self.sleepNotification), name: NSWorkspace.willSleepNotification, object: nil)
@@ -473,7 +472,7 @@ extension AppDelegate: MediaKeyTapDelegate {
}
@objc private func colorSyncSettingsChanged() {
- // We should perform a protected colorsync reset here using CGDisplayRestoreColorSyncSettings(), black bug check and recovery if needed
- // Afterwards we should perform a swUpdateDefaultGammaTable() for every display
+ CGDisplayRestoreColorSyncSettings()
+ self.displayReconfigured()
}
}
diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist
index 057368c..3d70ece 100644
--- a/MonitorControl/Info.plist
+++ b/MonitorControl/Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
$(MARKETING_VERSION)
CFBundleVersion
- 2322
+ 2328
LSApplicationCategoryType
public.app-category.utilities
LSMinimumSystemVersion
diff --git a/MonitorControlHelper/Info.plist b/MonitorControlHelper/Info.plist
index ea96c15..f0118ce 100644
--- a/MonitorControlHelper/Info.plist
+++ b/MonitorControlHelper/Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
$(MARKETING_VERSION)
CFBundleVersion
- 2322
+ 2328
LSApplicationCategoryType
public.app-category.utilities
LSBackgroundOnly