diff options
-rw-r--r-- | DomeKey/AppDelegate.m | 1 | ||||
-rw-r--r-- | DomeKey/HeadphoneKey.h | 1 | ||||
-rw-r--r-- | DomeKey/HeadphoneKey.m | 41 |
3 files changed, 0 insertions, 43 deletions
diff --git a/DomeKey/AppDelegate.m b/DomeKey/AppDelegate.m index a1e6563..bcd4dd0 100644 --- a/DomeKey/AppDelegate.m +++ b/DomeKey/AppDelegate.m @@ -22,7 +22,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification { _headphone_key = [[HeadphoneKey alloc] initWithTimeout:_config->timeout]; - [_headphone_key startMonitoringBluetoothEvents]; } @end diff --git a/DomeKey/HeadphoneKey.h b/DomeKey/HeadphoneKey.h index ad6f8dd..be0e62c 100644 --- a/DomeKey/HeadphoneKey.h +++ b/DomeKey/HeadphoneKey.h @@ -30,6 +30,5 @@ static const Milliseconds TIMEOUT_DEFAULT = 500; - (instancetype)initWithTimeout:(Milliseconds)timeout; - (void)handleDeadKey:(HeadphoneButton)button; - (void)runAction; -- (void)startMonitoringBluetoothEvents; @end diff --git a/DomeKey/HeadphoneKey.m b/DomeKey/HeadphoneKey.m index 5a83ad0..5cf0806 100644 --- a/DomeKey/HeadphoneKey.m +++ b/DomeKey/HeadphoneKey.m @@ -71,47 +71,6 @@ } } -- (void)startMonitoringBluetoothEvents -{ - // https://github.com/jguice/mac-bt-headset-fix/blob/master/Spotify%20Bluetooth%20Headset%20Listener/KDMAppDelegate.m - [NSEvent - addGlobalMonitorForEventsMatchingMask:(NSKeyDownMask | NSSystemDefinedMask) - handler:^(NSEvent *theEvent) { - int key_code = (([theEvent data1] & 0xFFFF0000) >> 16); - int key_flags = ([theEvent data1] & 0x0000FFFF); - int key_state = (((key_flags & 0xFF00) >> 8)) == 0xA; - - NSLog(@"Key from global monitor pressed"); - - // TODO: Fix magic numbers - if (key_code == 10 && key_flags == 6972) { - switch ([theEvent data2]) { - case 786608: - case 786637: - NSLog(@"Play"); - - break; - case 786611: - NSLog(@"Next"); - - break; - case 786612: - NSLog(@"Previous"); - - break; - case 786613: - NSLog(@"Fast-forward"); - - break; - case 786614: - NSLog(@"Rewind"); - - break; - } - } - }]; -} - - (void)handleDeadKey:(HeadphoneButton)button { NSNumber *storable_button = [NSNumber numberWithUnsignedInteger:button]; |