aboutsummaryrefslogtreecommitdiffstats
path: root/Framework/MASShortcutMonitor.m
diff options
context:
space:
mode:
authorTomáš Znamenáček2015-01-12 16:34:18 +0100
committerTomáš Znamenáček2015-01-12 17:10:20 +0100
commitb9b1964b3f5e8a7cf6ef76fbf2d019cdad9a9063 (patch)
tree58d22feb9e2ea4498907f450ed9acfe9f3d88763 /Framework/MASShortcutMonitor.m
parent5208c981afc49f4621dd70f1d193af1342846aeb (diff)
downloadMASShortcut-b9b1964b3f5e8a7cf6ef76fbf2d019cdad9a9063.tar.bz2
Non-exclusive hotkey registration (#56).
Diffstat (limited to 'Framework/MASShortcutMonitor.m')
-rw-r--r--Framework/MASShortcutMonitor.m11
1 files changed, 8 insertions, 3 deletions
diff --git a/Framework/MASShortcutMonitor.m b/Framework/MASShortcutMonitor.m
index 099f4b1..fce8022 100644
--- a/Framework/MASShortcutMonitor.m
+++ b/Framework/MASShortcutMonitor.m
@@ -45,11 +45,16 @@ static OSStatus MASCarbonEventCallback(EventHandlerCallRef, EventRef, void*);
#pragma mark Registration
-- (void) registerShortcut: (MASShortcut*) shortcut withAction: (dispatch_block_t) action
+- (BOOL) registerShortcut: (MASShortcut*) shortcut withAction: (dispatch_block_t) action
{
MASHotKey *hotKey = [MASHotKey registeredHotKeyWithShortcut:shortcut];
- [hotKey setAction:action];
- [_hotKeys setObject:hotKey forKey:shortcut];
+ if (hotKey) {
+ [hotKey setAction:action];
+ [_hotKeys setObject:hotKey forKey:shortcut];
+ return YES;
+ } else {
+ return NO;
+ }
}
- (void) unregisterShortcut: (MASShortcut*) shortcut