cocoabits / MASShortcut

Modern framework for managing global keyboard shortcuts compatible with Mac App Store. More details:
http://blog.shpakovski.com/2012/07/global-keyboard-shortcuts-in-cocoa.html
BSD 2-Clause "Simplified" License
1.52k stars 220 forks source link

Support for re-type the shortcut in MACShortcutView #115

Open dstd opened 6 years ago

dstd commented 6 years ago

When MASShortcutView starts the recording, a shortcut it currently holding will be temporarily deactivated to allow the user to type the same shortcut.

RaimundasSakalauskas commented 1 year ago

@dstd it seems that owner of this repository would be fine with merging this if there wouldn't be conflicts. Do you think you could take a look at this?

mcint commented 1 year ago

I can't tell what the merge conflict is. I can't see it in the web ui, and when I clone locally, merging fix-shortcut-changing into master (fetched latest first), it resolves automatically with "ort" strategy.

Here's the diff from the merge, that successfully completed automatically:

diff --cc Framework/UI/MASShortcutView.m
index e958994,8759a29..621946a
--- a/Framework/UI/MASShortcutView.m
+++ b/Framework/UI/MASShortcutView.m
@@@ -1,7 -1,7 +1,8 @@@
  #import "MASShortcutView.h"
  #import "MASShortcutValidator.h"
+ #import "MASShortcutMonitor.h"
  #import "MASLocalization.h"
 +#import "MASShortcutViewButtonCell.h"

  NSString *const MASShortcutBinding = @"shortcutValue";

@@@ -142,8 -136,8 +143,9 @@@ static const CGFloat MASButtonFontSize
      [self resetToolTips];
      [self activateEventMonitoring:_recording];
      [self activateResignObserver:_recording];
 +    [self invalidateIntrinsicContentSize];
      [self setNeedsDisplay:YES];
+     [[MASShortcutMonitor sharedMonitor] setShortcut:[self shortcutValue] active:!flag];

      // Give VoiceOver users feedback on the result. Requires at least 10.9 to run.
      // We’re silencing the “tautological compare” warning here so that if someone