Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions MacMediaKeyForwarder/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,12 @@ - (void)applicationDidBecomeActive:(NSNotification *)notification

- ( void ) applicationDidFinishLaunching : ( NSNotification*) theNotification
{
// Prevent macOS Automatic Termination from killing this windowless menu bar app
[[NSProcessInfo processInfo] disableAutomaticTermination:@"Media key forwarding active"];
[[NSProcessInfo processInfo] disableSuddenTermination];

// init containers

priorityOptionItems = [[NSMutableArray alloc] init];
pauseOptionItems = [[NSMutableArray alloc] init];

Expand Down Expand Up @@ -422,15 +426,13 @@ - ( void ) startEventSession
{
if (pauseState != PauseStatePause && !CFRunLoopContainsSource(CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes)) {
CFRunLoopAddSource( CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes );
CFRunLoopRun();
}
}

- ( void ) stopEventSession
{
if (CFRunLoopContainsSource(CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes)) {
CFRunLoopRemoveSource( CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes );
CFRunLoopStop(CFRunLoopGetCurrent());
}
}

Expand Down