aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Low Battery Yup/AppDelegate.h1
-rw-r--r--Low Battery Yup/AppDelegate.m11
2 files changed, 11 insertions, 1 deletions
diff --git a/Low Battery Yup/AppDelegate.h b/Low Battery Yup/AppDelegate.h
index a2c8ba9..3998e46 100644
--- a/Low Battery Yup/AppDelegate.h
+++ b/Low Battery Yup/AppDelegate.h
@@ -7,6 +7,7 @@
//
#import <Cocoa/Cocoa.h>
+#import <MASShortcut/MASShortcut.h>
#import "ShortcutView.h"
@interface AppDelegate : NSObject <NSApplicationDelegate> {
diff --git a/Low Battery Yup/AppDelegate.m b/Low Battery Yup/AppDelegate.m
index d90bc97..9f3e367 100644
--- a/Low Battery Yup/AppDelegate.m
+++ b/Low Battery Yup/AppDelegate.m
@@ -8,6 +8,8 @@
#import "AppDelegate.h"
+static NSString *const kPreferenceGlobalShortcut = @"GlobalShortcut";
+
@implementation AppDelegate
- (void)dealloc
@@ -17,7 +19,14 @@
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
-
+ NSDictionary *saved_shortcut;
+ if ((saved_shortcut = [[NSUserDefaults standardUserDefaults] objectForKey:kPreferenceGlobalShortcut])) {
+ MASShortcut *shortcut = [MASShortcut
+ shortcutWithKeyCode:[[saved_shortcut objectForKey:@"keyCode"] unsignedIntegerValue]
+ modifierFlags:[[saved_shortcut objectForKey:@"modifierFlags"] unsignedIntegerValue]];
+
+ [_shortcut_view setShortcutValue:shortcut];
+ }
}
@end