Skip to content

Instantly share code, notes, and snippets.

@jcuffe
Created August 11, 2012 01:00
Show Gist options
  • Select an option

  • Save jcuffe/3319601 to your computer and use it in GitHub Desktop.

Select an option

Save jcuffe/3319601 to your computer and use it in GitHub Desktop.
- (void)registerIntervalHotKey {
DDHotKeyCenter *startInterval = [[DDHotKeyCenter alloc] init];
DDHotKeyCenter *stopInterval = [[DDHotKeyCenter alloc] init];
DDHotKeyTask startIntervalTask = ^(NSEvent *hkEvent) {
[Interval startInterval];
};
DDHotKeyTask stopIntervalTask = ^(NSEvent *hkEvent) {
[Interval stopInterval];
};
if (![startInterval registerHotKeyWithKeyCode:21 modifierFlags:(NSControlKeyMask | NSCommandKeyMask) task:startIntervalTask]) {
return;
}
if (![stopInterval registerHotKeyWithKeyCode:22 modifierFlags:(NSControlKeyMask | NSCommandKeyMask) task:stopIntervalTask]) {
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment