Fix media key hook for Mojave.

CQTexperiment
Christopher Snowhill 2018-06-28 05:04:15 -07:00
parent 6a0ef6cc03
commit 9606567b03
1 changed files with 4 additions and 8 deletions

View File

@ -35,16 +35,12 @@
if([SPMediaKeyTap usesGlobalMediaKeyTap]) {
if (![keyTap startWatchingMediaKeys]) {
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:@"Retry"];
[alert addButtonWithTitle:@"Cancel"];
[alert addButtonWithTitle:@"OK"];
[alert setMessageText:@"Enable Media Key access?"];
[alert setInformativeText:@"Media Key support requires the \"Accessibility\" permission."];
[alert setInformativeText:@"Media Key support requires the \"Accessibility\" permission. You will need to restart the application for the change to take effect."];
[alert setAlertStyle:NSInformationalAlertStyle];
if ([alert runModal] == NSAlertFirstButtonReturn) {
NSString *path = [[NSBundle mainBundle] executablePath];
NSString *processID = [NSString stringWithFormat:@"%d",[[NSProcessInfo processInfo] processIdentifier]];
[NSTask launchedTaskWithLaunchPath:path arguments:[NSArray arrayWithObjects:path,processID,nil]];
}
[alert runModal];
ALog(@"Media key monitoring disabled until application is restarted");
}
}
else