aboutsummaryrefslogtreecommitdiffstats
path: root/Low Battery Yup
diff options
context:
space:
mode:
authorTeddy Wing2016-12-01 09:36:16 -0500
committerTeddy Wing2016-12-01 09:36:16 -0500
commitf697d6f3e8445e781273c0e5862fde7c230bf579 (patch)
tree309f80cf86b39a29166d2ab1238d5417654e54bf /Low Battery Yup
parent91599928cb4412c85bb7f54e9146906070fd01cd (diff)
downloadLow-Battery-Yup-f697d6f3e8445e781273c0e5862fde7c230bf579.tar.bz2
ShortcutView: Store updated shortcut in NSUserDefaults
This will enable us to access it later in the daemon.
Diffstat (limited to 'Low Battery Yup')
-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