diff options
| author | Teddy Wing | 2016-12-01 09:36:16 -0500 |
|---|---|---|
| committer | Teddy Wing | 2016-12-01 09:36:16 -0500 |
| commit | f697d6f3e8445e781273c0e5862fde7c230bf579 (patch) | |
| tree | 309f80cf86b39a29166d2ab1238d5417654e54bf | |
| parent | 91599928cb4412c85bb7f54e9146906070fd01cd (diff) | |
| download | Low-Battery-Yup-f697d6f3e8445e781273c0e5862fde7c230bf579.tar.bz2 | |
ShortcutView: Store updated shortcut in NSUserDefaults
This will enable us to access it later in the daemon.
| -rw-r--r-- | Low Battery Yup/ShortcutView.m | 12 |
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 |
