diff --git a/Sparkle/SUAutomaticUpdateAlert.m b/Sparkle/SUAutomaticUpdateAlert.m index 571b9dfb..2c11a6e9 100644 --- a/Sparkle/SUAutomaticUpdateAlert.m +++ b/Sparkle/SUAutomaticUpdateAlert.m @@ -110,10 +110,10 @@ - (NSTouchBar *)makeTouchBar { self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className]; - [self.touchBarProvider addButtonWithButton:self.skipButton]; + [self.touchBarProvider addButtonWithButton:self.skipButton isDefault:NO]; [self.touchBarProvider addSpace]; - [self.touchBarProvider addButtonWithButton:self.laterButton]; - [self.touchBarProvider addButtonWithButton:self.installButton].keyEquivalent = @"\r"; + [self.touchBarProvider addButtonWithButton:self.laterButton isDefault:NO]; + [self.touchBarProvider addButtonWithButton:self.installButton isDefault:YES]; [self.touchBarProvider addSpace]; [self.touchBarProvider addSpace]; return self.touchBarProvider.touchBar; diff --git a/Sparkle/SUStatusController.m b/Sparkle/SUStatusController.m index 7697fcdc..aeb22499 100644 --- a/Sparkle/SUStatusController.m +++ b/Sparkle/SUStatusController.m @@ -135,7 +135,7 @@ - (NSTouchBar *)makeTouchBar { self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className]; - self.touchBarButton = [self.touchBarProvider addButtonWithButton:self.actionButton]; + self.touchBarButton = [self.touchBarProvider addButtonWithButton:self.actionButton isDefault:[self.actionButton.keyEquivalent isEqualToString:@"\r"]]; return self.touchBarProvider.touchBar; } diff --git a/Sparkle/SUTouchBarProvider.h b/Sparkle/SUTouchBarProvider.h index ffb2f9a8..11d4cba8 100644 --- a/Sparkle/SUTouchBarProvider.h +++ b/Sparkle/SUTouchBarProvider.h @@ -15,7 +15,7 @@ @property (strong, readonly) NSTouchBar *touchBar; -(instancetype)initWithIdentifier:(NSString *)identifier; --(NSButton *)addButtonWithButton:(NSButton *)button; +-(NSButton *)addButtonWithButton:(NSButton *)button isDefault:(BOOL)isDefault; -(void)addSpace; @end diff --git a/Sparkle/SUTouchBarProvider.m b/Sparkle/SUTouchBarProvider.m index 7f7886e2..015f46df 100644 --- a/Sparkle/SUTouchBarProvider.m +++ b/Sparkle/SUTouchBarProvider.m @@ -46,14 +46,16 @@ return nil; } --(NSButton *)addButtonWithButton:(NSButton *)button +-(NSButton *)addButtonWithButton:(NSButton *)button isDefault:(BOOL)isDefault { NSString *itemId = [self.indentifier stringByAppendingFormat:@".button-%lu", self.touchBarItems.count]; NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:itemId]; NSButton *buttonCopy = [NSButton buttonWithTitle:button.title target:button.target action:button.action]; - buttonCopy.keyEquivalent = button.keyEquivalent; buttonCopy.tag = button.tag; + if (isDefault) { + buttonCopy.keyEquivalent = @"\r"; + } [buttonCopy bind:@"title" toObject:button withKeyPath:@"title" options:nil]; [buttonCopy bind:@"enabled" toObject:button withKeyPath:@"enabled" options:nil]; diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index acc2bb40..60e0e9b2 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -327,10 +327,10 @@ - (NSTouchBar *)makeTouchBar { self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className]; - [self.touchBarProvider addButtonWithButton:self.skipButton]; + [self.touchBarProvider addButtonWithButton:self.skipButton isDefault:NO]; [self.touchBarProvider addSpace]; - [self.touchBarProvider addButtonWithButton:self.laterButton]; - [self.touchBarProvider addButtonWithButton:self.installButton].keyEquivalent = @"\r"; + [self.touchBarProvider addButtonWithButton:self.laterButton isDefault:NO]; + [self.touchBarProvider addButtonWithButton:self.installButton isDefault:YES]; [self.touchBarProvider addSpace]; [self.touchBarProvider addSpace]; return self.touchBarProvider.touchBar; diff --git a/Sparkle/SUUpdatePermissionPrompt.m b/Sparkle/SUUpdatePermissionPrompt.m index 5e7822aa..e236bf6d 100644 --- a/Sparkle/SUUpdatePermissionPrompt.m +++ b/Sparkle/SUUpdatePermissionPrompt.m @@ -170,8 +170,8 @@ - (NSTouchBar *)makeTouchBar { self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className]; - [self.touchBarProvider addButtonWithButton:self.cancelButton]; - [self.touchBarProvider addButtonWithButton:self.checkButton].keyEquivalent = @"\r"; + [self.touchBarProvider addButtonWithButton:self.cancelButton isDefault:NO]; + [self.touchBarProvider addButtonWithButton:self.checkButton isDefault:YES]; return self.touchBarProvider.touchBar; }