aboutsummaryrefslogtreecommitdiffstats
path: root/Low Battery Yup d/AppDelegate.m
blob: 7aa29fe7cb7f3e4f15284b7b49c75d61f143be00 (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 <Carbon/Carbon.h>

@implementation AppDelegate

- (void)dealloc
{
	[_mouse release];
	[super dealloc];
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
	_mouse = [[Mouse alloc] init];

	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 moveToLowBatteryOK];
	[_mouse click];
}

@end