From e64c279e45993ea61de17cea7c0a62d8a3bca924 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sun, 9 Mar 2025 14:23:59 -0700 Subject: [PATCH] Disable global hotkeys again for macOS < 15.0 Clearly, NSUserDefaults bindings were not really meant to be used in practice at all, as they do nothing but crash the app. Signed-off-by: Christopher Snowhill --- Application/AppController.m | 12 +++++---- .../Preferences/GeneralPreferencesPlugin.m | 26 +++++++++++++------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Application/AppController.m b/Application/AppController.m index ae785f94d..e137d46e4 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -186,11 +186,13 @@ static BOOL consentLastEnabled = NO; [randomizeButton setToolTip:NSLocalizedString(@"RandomizeButtonTooltip", @"")]; [fileButton setToolTip:NSLocalizedString(@"FileButtonTooltip", @"")]; - [self registerDefaultHotKeys]; - - [self migrateHotKeys]; - - [self registerHotKeys]; + if(@available(macOS 15, *)) { + [self registerDefaultHotKeys]; + + [self migrateHotKeys]; + + [self registerHotKeys]; + } (void)[spotlightWindowController init]; diff --git a/Preferences/Preferences/GeneralPreferencesPlugin.m b/Preferences/Preferences/GeneralPreferencesPlugin.m index e43f6cfdd..f7ea717f9 100644 --- a/Preferences/Preferences/GeneralPreferencesPlugin.m +++ b/Preferences/Preferences/GeneralPreferencesPlugin.m @@ -41,14 +41,24 @@ [[NSBundle bundleWithIdentifier:@"org.cogx.cog.preferences"] loadNibNamed:@"Preferences" owner:plugin topLevelObjects:nil]; - return @[[plugin playlistPane], - [plugin hotKeyPane], - [plugin outputPane], - [plugin generalPane], - [plugin notificationsPane], - [plugin appearancePane], - [plugin midiPane], - [plugin rubberbandPane]]; + if(@available(macos 15, *)) { + return @[[plugin playlistPane], + [plugin hotKeyPane], + [plugin outputPane], + [plugin generalPane], + [plugin notificationsPane], + [plugin appearancePane], + [plugin midiPane], + [plugin rubberbandPane]]; + } else { + return @[[plugin playlistPane], + [plugin outputPane], + [plugin generalPane], + [plugin notificationsPane], + [plugin appearancePane], + [plugin midiPane], + [plugin rubberbandPane]]; + } } - (HotKeyPane *)hotKeyPane {