mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 11:42:30 +00:00
Hotkey now gets registers with default values if no user data is present
This commit is contained in:
@@ -191,20 +191,26 @@ NSString *const kMPApplciationNameKey = @"applicationName";
|
||||
#pragma mark Hotkey Registration
|
||||
|
||||
- (void)_registerHotKey {
|
||||
if(nil == self.hotKeyData) {
|
||||
return; // No hotkey data defined, so nothign to do
|
||||
}
|
||||
__weak MPAutotypeDaemon *welf = self;
|
||||
DDHotKey *storedHotkey = [[DDHotKey alloc] initWithKeyData:self.hotKeyData taks:^(NSEvent *event) {
|
||||
DDHotKeyTask aTask = ^(NSEvent *event) {
|
||||
[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];
|
||||
}
|
||||
|
||||
- (void)_unregisterHotKey {
|
||||
if(nil != self.registredHotKey) {
|
||||
[[DDHotKeyCenter sharedHotKeyCenter] unregisterHotKey:self.registredHotKey];
|
||||
self.registredHotKey = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSDictionary *)_frontMostApplicationInfoDict {
|
||||
NSRunningApplication *frontApplication = [[NSWorkspace sharedWorkspace] frontmostApplication];
|
||||
|
||||
Reference in New Issue
Block a user