Skip to content

Commit 0bcc6a3

Browse files
authored
Various fixes and updates for Sequoia - v4.3.2 (#1632)
1 parent f625dc1 commit 0bcc6a3

File tree

15 files changed

+171
-170
lines changed

15 files changed

+171
-170
lines changed

MonitorControl.xcodeproj/project.pbxproj

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,9 @@
427427
56754EA31D9A4016007BCDC5 /* Project object */ = {
428428
isa = PBXProject;
429429
attributes = {
430+
BuildIndependentTargetsInParallel = YES;
430431
LastSwiftUpdateCheck = 0920;
431-
LastUpgradeCheck = 1250;
432+
LastUpgradeCheck = 1610;
432433
ORGANIZATIONNAME = MonitorControl;
433434
TargetAttributes = {
434435
56754EAA1D9A4016007BCDC5 = {
@@ -521,6 +522,7 @@
521522
/* Begin PBXShellScriptBuildPhase section */
522523
28D1DE0C227FCFAF004CB494 /* [Format] Run SwiftFormat */ = {
523524
isa = PBXShellScriptBuildPhase;
525+
alwaysOutOfDate = 1;
524526
buildActionMask = 12;
525527
files = (
526528
);
@@ -539,6 +541,7 @@
539541
};
540542
28F6A5802283515F00A4ADCD /* Increase Build Number */ = {
541543
isa = PBXShellScriptBuildPhase;
544+
alwaysOutOfDate = 1;
542545
buildActionMask = 2147483647;
543546
files = (
544547
);
@@ -557,6 +560,7 @@
557560
};
558561
28F6A5822283548F00A4ADCD /* Sync Version Numbers */ = {
559562
isa = PBXShellScriptBuildPhase;
563+
alwaysOutOfDate = 1;
560564
buildActionMask = 2147483647;
561565
files = (
562566
);
@@ -575,6 +579,7 @@
575579
};
576580
6CB1BDB2253C7EBE00B52124 /* [Localization] Run BartyCrouch */ = {
577581
isa = PBXShellScriptBuildPhase;
582+
alwaysOutOfDate = 1;
578583
buildActionMask = 12;
579584
files = (
580585
);
@@ -589,10 +594,11 @@
589594
);
590595
runOnlyForDeploymentPostprocessing = 0;
591596
shellPath = /bin/sh;
592-
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which bartycrouch > /dev/null; then\n bartycrouch update -x\n bartycrouch lint -x\nelse\n echo \"warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch\"\nfi\n";
597+
shellScript = "echo Skipping bartycrouch\n# export PATH=\"$PATH:/opt/homebrew/bin\"\n# if which bartycrouch > /dev/null; then\n# bartycrouch update -x\n# bartycrouch lint -x\n# else\n# echo \"warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch\"\n# fi\n";
593598
};
594599
F03A8DF01FFB9D4C0034DC27 /* [Lint] Run SwiftLint */ = {
595600
isa = PBXShellScriptBuildPhase;
601+
alwaysOutOfDate = 1;
596602
buildActionMask = 12;
597603
files = (
598604
);
@@ -769,6 +775,7 @@
769775
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
770776
CODE_SIGN_IDENTITY = "-";
771777
COPY_PHASE_STRIP = NO;
778+
DEAD_CODE_STRIPPING = YES;
772779
DEBUG_INFORMATION_FORMAT = dwarf;
773780
ENABLE_STRICT_OBJC_MSGSEND = YES;
774781
ENABLE_TESTABILITY = YES;
@@ -830,6 +837,7 @@
830837
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
831838
CODE_SIGN_IDENTITY = "-";
832839
COPY_PHASE_STRIP = NO;
840+
DEAD_CODE_STRIPPING = YES;
833841
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
834842
ENABLE_NS_ASSERTIONS = NO;
835843
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -856,10 +864,12 @@
856864
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
857865
CODE_SIGN_ENTITLEMENTS = MonitorControl/MonitorControlDebug.entitlements;
858866
CODE_SIGN_IDENTITY = "-";
867+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
859868
CODE_SIGN_STYLE = Automatic;
860869
COMBINE_HIDPI_IMAGES = YES;
861-
CURRENT_PROJECT_VERSION = 1179;
862-
DEVELOPMENT_TEAM = "";
870+
CURRENT_PROJECT_VERSION = 7100;
871+
DEAD_CODE_STRIPPING = YES;
872+
DEVELOPMENT_TEAM = 299YSU96J7;
863873
ENABLE_HARDENED_RUNTIME = YES;
864874
FRAMEWORK_SEARCH_PATHS = (
865875
"$(PROJECT_DIR)/**",
@@ -871,8 +881,8 @@
871881
"@executable_path/../Frameworks",
872882
);
873883
MACOSX_DEPLOYMENT_TARGET = 10.14;
874-
MARKETING_VERSION = 4.2.1;
875-
PRODUCT_BUNDLE_IDENTIFIER = me.guillaumeb.MonitorControl;
884+
MARKETING_VERSION = 4.3.2;
885+
PRODUCT_BUNDLE_IDENTIFIER = app.monitorcontrol.MonitorControl;
876886
PRODUCT_NAME = "$(TARGET_NAME)";
877887
PROVISIONING_PROFILE_SPECIFIER = "";
878888
SWIFT_OBJC_BRIDGING_HEADER = "MonitorControl/Support/Bridging-Header.h";
@@ -891,10 +901,12 @@
891901
ARCHS = "$(ARCHS_STANDARD)";
892902
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
893903
CODE_SIGN_IDENTITY = "-";
904+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
894905
CODE_SIGN_STYLE = Automatic;
895906
COMBINE_HIDPI_IMAGES = YES;
896-
CURRENT_PROJECT_VERSION = 1179;
897-
DEVELOPMENT_TEAM = "";
907+
CURRENT_PROJECT_VERSION = 7100;
908+
DEAD_CODE_STRIPPING = YES;
909+
DEVELOPMENT_TEAM = 299YSU96J7;
898910
ENABLE_HARDENED_RUNTIME = YES;
899911
FRAMEWORK_SEARCH_PATHS = (
900912
"$(PROJECT_DIR)/**",
@@ -906,8 +918,8 @@
906918
"@executable_path/../Frameworks",
907919
);
908920
MACOSX_DEPLOYMENT_TARGET = 10.14;
909-
MARKETING_VERSION = 4.2.1;
910-
PRODUCT_BUNDLE_IDENTIFIER = me.guillaumeb.MonitorControl;
921+
MARKETING_VERSION = 4.3.2;
922+
PRODUCT_BUNDLE_IDENTIFIER = app.monitorcontrol.MonitorControl;
911923
PRODUCT_NAME = "$(TARGET_NAME)";
912924
PROVISIONING_PROFILE_SPECIFIER = "";
913925
SWIFT_OBJC_BRIDGING_HEADER = "MonitorControl/Support/Bridging-Header.h";
@@ -929,10 +941,12 @@
929941
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
930942
CODE_SIGN_ENTITLEMENTS = MonitorControlHelper/MonitorControlHelper.entitlements;
931943
CODE_SIGN_IDENTITY = "-";
944+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
932945
CODE_SIGN_STYLE = Automatic;
933946
COMBINE_HIDPI_IMAGES = YES;
934-
CURRENT_PROJECT_VERSION = 631;
935-
DEVELOPMENT_TEAM = "";
947+
CURRENT_PROJECT_VERSION = 7100;
948+
DEAD_CODE_STRIPPING = YES;
949+
DEVELOPMENT_TEAM = 299YSU96J7;
936950
ENABLE_HARDENED_RUNTIME = YES;
937951
GCC_C_LANGUAGE_STANDARD = gnu11;
938952
INFOPLIST_FILE = MonitorControlHelper/Info.plist;
@@ -942,7 +956,7 @@
942956
);
943957
MACOSX_DEPLOYMENT_TARGET = 10.14;
944958
MARKETING_VERSION = 4.1.0;
945-
PRODUCT_BUNDLE_IDENTIFIER = me.guillaumeb.MonitorControlHelper;
959+
PRODUCT_BUNDLE_IDENTIFIER = app.monitorcontrol.MonitorControlHelper;
946960
PRODUCT_NAME = "$(TARGET_NAME)";
947961
SKIP_INSTALL = YES;
948962
SWIFT_VERSION = 5.5;
@@ -958,10 +972,12 @@
958972
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
959973
CODE_SIGN_ENTITLEMENTS = MonitorControlHelper/MonitorControlHelper.entitlements;
960974
CODE_SIGN_IDENTITY = "-";
975+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
961976
CODE_SIGN_STYLE = Automatic;
962977
COMBINE_HIDPI_IMAGES = YES;
963-
CURRENT_PROJECT_VERSION = 631;
964-
DEVELOPMENT_TEAM = "";
978+
CURRENT_PROJECT_VERSION = 7100;
979+
DEAD_CODE_STRIPPING = YES;
980+
DEVELOPMENT_TEAM = 299YSU96J7;
965981
ENABLE_HARDENED_RUNTIME = YES;
966982
GCC_C_LANGUAGE_STANDARD = gnu11;
967983
INFOPLIST_FILE = MonitorControlHelper/Info.plist;
@@ -971,7 +987,7 @@
971987
);
972988
MACOSX_DEPLOYMENT_TARGET = 10.14;
973989
MARKETING_VERSION = 4.1.0;
974-
PRODUCT_BUNDLE_IDENTIFIER = me.guillaumeb.MonitorControlHelper;
990+
PRODUCT_BUNDLE_IDENTIFIER = app.monitorcontrol.MonitorControlHelper;
975991
PRODUCT_NAME = "$(TARGET_NAME)";
976992
SKIP_INSTALL = YES;
977993
SWIFT_VERSION = 5.5;

MonitorControl.xcodeproj/xcshareddata/xcschemes/MonitorControl.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1250"
3+
LastUpgradeVersion = "1610"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

MonitorControl/Enums/PrefKey.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ enum MenuIcon: Int {
194194
}
195195

196196
enum MenuItemStyle: Int {
197-
case text = 0
198-
case icon = 1
197+
case icon = 0
198+
case text = 1
199199
case hide = 2
200200
}
201201

MonitorControl/Info.plist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>$(MARKETING_VERSION)</string>
2121
<key>CFBundleVersion</key>
22-
<string>7052</string>
22+
<string>7104</string>
2323
<key>LSApplicationCategoryType</key>
2424
<string>public.app-category.utilities</string>
2525
<key>LSMinimumSystemVersion</key>
@@ -33,8 +33,8 @@
3333
<key>SUEnableJavaScript</key>
3434
<true/>
3535
<key>SUFeedURL</key>
36-
<string>https://monitorcontrol.app/appcast.xml</string>
36+
<string>https://monitorcontrol.app/appcast2.xml</string>
3737
<key>SUPublicEDKey</key>
38-
<string>KuISgz+2n2/qnP/Rom5nWYAp+Pru+U3UtnAlnUjj6Pw=</string>
38+
<string>ITSTMp8AypsLawojJ+UR3tm2mN18AFoNMvXf1G3t62s=</string>
3939
</dict>
4040
</plist>

MonitorControl/Model/AppleDisplay.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ class AppleDisplay: Display {
2424
guard !self.isDummy else {
2525
return
2626
}
27-
self.displayQueue.sync {
27+
_ = self.displayQueue.sync {
2828
DisplayServicesSetBrightness(self.identifier, value)
29-
DisplayServicesBrightnessChanged(self.identifier, Double(value))
3029
}
3130
}
3231

MonitorControl/Support/AppDelegate.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
6464

6565
@objc func quitClicked(_: AnyObject) {
6666
os_log("Quit clicked", type: .info)
67-
NSApplication.shared.terminate(self)
67+
menu.closeMenu()
68+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
69+
NSApplication.shared.terminate(self)
70+
}
6871
}
6972

7073
@objc func prefsClicked(_: AnyObject) {

MonitorControl/Support/Arm64DDC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Arm64DDC: NSObject {
104104
}
105105
if !reply.isEmpty {
106106
usleep(readSleepTime ?? 50000)
107-
if IOAVServiceReadI2C(service, UInt32(ARM64_DDC_7BIT_ADDRESS), UInt32(dataAddress), &reply, UInt32(reply.count)) == 0 {
107+
if IOAVServiceReadI2C(service, UInt32(ARM64_DDC_7BIT_ADDRESS), 0, &reply, UInt32(reply.count)) == 0 {
108108
success = self.checksum(chk: 0x50, data: &reply, start: 0, end: reply.count - 2) == reply[reply.count - 1]
109109
}
110110
}

MonitorControl/Support/Bridging-Header.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ extern IOReturn IOAVServiceReadI2C(IOAVService service, uint32_t chipAddress, ui
1313
extern IOReturn IOAVServiceWriteI2C(IOAVService service, uint32_t chipAddress, uint32_t dataAddress, void* inputBuffer, uint32_t inputBufferSize);
1414
extern CFDictionaryRef CoreDisplay_DisplayCreateInfoDictionary(CGDirectDisplayID);
1515

16-
extern void DisplayServicesBrightnessChanged(CGDirectDisplayID display, double brightness);
1716
extern int DisplayServicesGetBrightness(CGDirectDisplayID display, float *brightness);
1817
extern int DisplayServicesSetBrightness(CGDirectDisplayID display, float brightness);
1918
extern int DisplayServicesGetLinearBrightness(CGDirectDisplayID display, float *brightness);
2019
extern int DisplayServicesSetLinearBrightness(CGDirectDisplayID display, float brightness);
2120

2221
extern void CGSServiceForDisplayNumber(CGDirectDisplayID display, io_service_t* service);
2322

23+
bool CGSIsHDREnabled(CGDirectDisplayID display) __attribute__((weak_import));
24+
bool CGSIsHDRSupported(CGDirectDisplayID display) __attribute__((weak_import));
25+
2426
@class NSString;
2527

2628
@protocol OSDUIHelperProtocol

MonitorControl/Support/DisplayManager.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,17 @@ class DisplayManager {
474474
}
475475

476476
static func isAppleDisplay(displayID: CGDirectDisplayID) -> Bool {
477+
if #available(macOS 15.0, *) {
478+
if CGDisplayVendorNumber(displayID) != 1552, CGSIsHDRSupported(displayID), CGSIsHDREnabled(displayID) {
479+
return CGDisplayIsBuiltin(displayID) != 0
480+
}
481+
}
477482
var brightness: Float = -1
478483
let ret = DisplayServicesGetBrightness(displayID, &brightness)
479484
if ret == 0, brightness >= 0 { // If brightness read appears to be successful using DisplayServices then it should be an Apple display
480485
return true
481486
}
482-
if CGDisplayIsBuiltin(displayID) != 0 { // If built-in display then it should be Apple (except for hackintosh notebooks...)
483-
return true
484-
}
485-
return false
487+
return CGDisplayIsBuiltin(displayID) != 0 // If built-in display, it should be Apple
486488
}
487489

488490
static func getByDisplayID(displayID: CGDirectDisplayID) -> NSScreen? {

MonitorControl/Support/MenuHandler.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class MenuHandler: NSMenu, NSMenuDelegate {
2424
app.keyboardShortcuts.disengage()
2525
}
2626

27+
func closeMenu() {
28+
self.cancelTrackingWithoutAnimation()
29+
}
30+
2731
func updateMenus(dontClose: Bool = false) {
2832
os_log("Menu update initiated", type: .info)
2933
if !dontClose {
@@ -210,7 +214,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
210214

211215
func addDefaultMenuOptions() {
212216
if !DEBUG_MACOS10, #available(macOS 11.0, *), prefs.integer(forKey: PrefKey.menuItemStyle.rawValue) == MenuItemStyle.icon.rawValue {
213-
let iconSize = CGFloat(22)
217+
let iconSize = CGFloat(18)
214218
let viewWidth = max(130, self.size.width)
215219
var compensateForBlock: CGFloat = 0
216220
if viewWidth > 230 { // if there are display blocks, we need to compensate a bit for the negative inset of the blocks
@@ -226,7 +230,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
226230
preferencesIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: NSLocalizedString("Preferences…", comment: "Shown in menu"))
227231
preferencesIcon.alternateImage = NSImage(systemSymbolName: "gearshape.fill", accessibilityDescription: NSLocalizedString("Preferences…", comment: "Shown in menu"))
228232
preferencesIcon.alphaValue = 0.3
229-
preferencesIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 30 - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
233+
preferencesIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 3 - 20 - 17 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
230234
preferencesIcon.imageScaling = .scaleProportionallyUpOrDown
231235
preferencesIcon.action = #selector(app.prefsClicked)
232236

@@ -239,7 +243,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
239243
updateIcon.alternateImage = NSImage(systemSymbolName: symbolName + ".fill", accessibilityDescription: NSLocalizedString("Check for updates…", comment: "Shown in menu"))
240244

241245
updateIcon.alphaValue = 0.3
242-
updateIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 2 - 10 - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
246+
updateIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize * 2 - 14 - 17 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
243247
updateIcon.imageScaling = .scaleProportionallyUpOrDown
244248
updateIcon.action = #selector(app.updaterController.checkForUpdates(_:))
245249
updateIcon.target = app.updaterController
@@ -252,7 +256,7 @@ class MenuHandler: NSMenu, NSMenuDelegate {
252256
quitIcon.image = NSImage(systemSymbolName: symbolName, accessibilityDescription: NSLocalizedString("Quit", comment: "Shown in menu"))
253257
quitIcon.alternateImage = NSImage(systemSymbolName: symbolName + ".fill", accessibilityDescription: NSLocalizedString("Quit", comment: "Shown in menu"))
254258
quitIcon.alphaValue = 0.3
255-
quitIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize - 16 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
259+
quitIcon.frame = NSRect(x: menuItemView.frame.maxX - iconSize - 17 + compensateForBlock, y: menuItemView.frame.origin.y + 5, width: iconSize, height: iconSize)
256260
quitIcon.imageScaling = .scaleProportionallyUpOrDown
257261
quitIcon.action = #selector(app.quitClicked)
258262

0 commit comments

Comments
 (0)