mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 22:42:18 +00:00
Hotkey now gets registers with default values if no user data is present
This commit is contained in:
@@ -191,19 +191,25 @@ NSString *const kMPApplciationNameKey = @"applicationName";
|
|||||||
#pragma mark Hotkey Registration
|
#pragma mark Hotkey Registration
|
||||||
|
|
||||||
- (void)_registerHotKey {
|
- (void)_registerHotKey {
|
||||||
if(nil == self.hotKeyData) {
|
|
||||||
return; // No hotkey data defined, so nothign to do
|
|
||||||
}
|
|
||||||
__weak MPAutotypeDaemon *welf = self;
|
__weak MPAutotypeDaemon *welf = self;
|
||||||
DDHotKey *storedHotkey = [[DDHotKey alloc] initWithKeyData:self.hotKeyData taks:^(NSEvent *event) {
|
DDHotKeyTask aTask = ^(NSEvent *event) {
|
||||||
[welf _didPressHotKey];
|
[welf _didPressHotKey];
|
||||||
}];
|
};
|
||||||
|
DDHotKey *storedHotkey;
|
||||||
|
if(nil == self.hotKeyData) {
|
||||||
|
storedHotkey = [DDHotKey hotKeyWithKeyCode:kVK_ANSI_M modifierFlags:kCGEventFlagMaskControl|kCGEventFlagMaskAlternate task:aTask];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
storedHotkey = [[DDHotKey alloc] initWithKeyData:self.hotKeyData taks:aTask];
|
||||||
|
}
|
||||||
self.registredHotKey = [[DDHotKeyCenter sharedHotKeyCenter] registerHotKey:storedHotkey];
|
self.registredHotKey = [[DDHotKeyCenter sharedHotKeyCenter] registerHotKey:storedHotkey];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_unregisterHotKey {
|
- (void)_unregisterHotKey {
|
||||||
|
if(nil != self.registredHotKey) {
|
||||||
[[DDHotKeyCenter sharedHotKeyCenter] unregisterHotKey:self.registredHotKey];
|
[[DDHotKeyCenter sharedHotKeyCenter] unregisterHotKey:self.registredHotKey];
|
||||||
self.registredHotKey = nil;
|
self.registredHotKey = nil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *)_frontMostApplicationInfoDict {
|
- (NSDictionary *)_frontMostApplicationInfoDict {
|
||||||
|
|||||||
Reference in New Issue
Block a user