blob: 51c1626b6231ab2202f1c7113203ce385d8b5bcc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
//
// AppDelegate.m
// Low Battery Yup.d
//
// Created by TW on 11/16/16.
// Copyright (c) 2016 TW. All rights reserved.
//
#import "AppDelegate.h"
#import "DDHotKeyCenter.h"
#import "Mouse.h"
#import <Carbon/Carbon.h>
@implementation AppDelegate
- (void)dealloc
{
[super dealloc];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
DDHotKeyCenter *hotkey_center = [DDHotKeyCenter sharedHotKeyCenter];
[hotkey_center registerHotKeyWithKeyCode:kVK_ANSI_0
modifierFlags:(NSCommandKeyMask | NSAlternateKeyMask | NSShiftKeyMask | NSControlKeyMask)
target:self
action:@selector(dismissLowBatteryWarning:)
object:nil];
}
- (void)dismissLowBatteryWarning:(NSEvent *)hotKeyEvent
{
Mouse *m = [[Mouse alloc] init];
[m moveToLowBatteryOK];
[m click];
[m release];
}
@end
|