aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Low Battery Yup/ShortcutView.m12
1 files changed, 10 insertions, 2 deletions
diff --git a/Low Battery Yup/ShortcutView.m b/Low Battery Yup/ShortcutView.m
index 5604834..216501f 100644
--- a/Low Battery Yup/ShortcutView.m
+++ b/Low Battery Yup/ShortcutView.m
@@ -8,12 +8,20 @@
#import "ShortcutView.h"
+static NSString *const kPreferenceGlobalShortcut = @"GlobalShortcut";
+
@implementation ShortcutView
- (void)setShortcutValue:(MASShortcut *)shortcutValue
{
- [super setShortcutValue:shortcutValue];
- NSLog(@"%@", shortcutValue);
+ [super setShortcutValue:shortcutValue];
+
+ NSDictionary *shortcut = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInteger:[shortcutValue keyCode]], @"keyCode",
+ [NSNumber numberWithInteger:[shortcutValue modifierFlags]], @"modifierFlags",
+ nil];
+
+ [[NSUserDefaults standardUserDefaults] setObject:shortcut forKey:kPreferenceGlobalShortcut];
}
@end