mborgerson / TrayPlay

An app for macOS that lives in your menu bar and lets you easily control iTunes or Spotify, without interrupting your workflow.
https://mborgerson.com/trayplay
GNU General Public License v3.0
143 stars 11 forks source link

TrayPlay won't let me quit iTunes #2

Open Fofer opened 9 years ago

Fofer commented 9 years ago

When TrayPlay launches on my Mac, it automatically launches iTunes. If I try to quit iTunes, it automatically relaunches.

The only way I can quit iTunes, is to first quit TrayPlay.

Any help?

OS X 10.10.3 iTunes 12.1.2.27 TrayPlay version 1.0.3

mborgerson commented 9 years ago

Yep. This is a bug. Thanks for reporting it!

Technical notes: It also happens with Spotify selected. This bug is caused by the way TrayPlay polls the application (i.e. iTunes, Spotify) for current status. See the update method. TrayPlay could check to see if the application is open before querying status and possibly display a message if the app is not currently open with a button to open the app and start playing.

Here's a way to check to see if an application is running:

BOOL isAppRunning(NSString *appLocalizedName)
{
    NSArray *apps = [[NSWorkspace sharedWorkspace] runningApplications];
    for (NSRunningApplication *app in apps)
        if ([app.localizedName isEqualToString:appLocalizedName])
            return YES;
    return NO;
}