Fix media key hook for Mojave.
parent
6a0ef6cc03
commit
9606567b03
|
@ -35,16 +35,12 @@
|
||||||
if([SPMediaKeyTap usesGlobalMediaKeyTap]) {
|
if([SPMediaKeyTap usesGlobalMediaKeyTap]) {
|
||||||
if (![keyTap startWatchingMediaKeys]) {
|
if (![keyTap startWatchingMediaKeys]) {
|
||||||
NSAlert *alert = [[NSAlert alloc] init];
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
[alert addButtonWithTitle:@"Retry"];
|
[alert addButtonWithTitle:@"OK"];
|
||||||
[alert addButtonWithTitle:@"Cancel"];
|
|
||||||
[alert setMessageText:@"Enable Media Key access?"];
|
[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];
|
[alert setAlertStyle:NSInformationalAlertStyle];
|
||||||
if ([alert runModal] == NSAlertFirstButtonReturn) {
|
[alert runModal];
|
||||||
NSString *path = [[NSBundle mainBundle] executablePath];
|
ALog(@"Media key monitoring disabled until application is restarted");
|
||||||
NSString *processID = [NSString stringWithFormat:@"%d",[[NSProcessInfo processInfo] processIdentifier]];
|
|
||||||
[NSTask launchedTaskWithLaunchPath:path arguments:[NSArray arrayWithObjects:path,processID,nil]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue