mamburu: Only launch last.fm client if it isn't already running (prevents last.fm client's window from popping up on Cog restarts)

CQTexperiment
Chris Moeller 2013-10-11 05:37:11 -07:00
parent 73524776e7
commit d98b5549d1
1 changed files with 17 additions and 4 deletions

View File

@ -73,8 +73,21 @@ escapeForLastFM(NSString *string)
_pluginID = @"cog";
if([[NSUserDefaults standardUserDefaults] boolForKey:@"automaticallyLaunchLastFM"])
if([[NSUserDefaults standardUserDefaults] boolForKey:@"automaticallyLaunchLastFM"]) {
NSArray *launchedApps = [[NSWorkspace sharedWorkspace] runningApplications];
BOOL running = NO;
for(NSRunningApplication *app in launchedApps) {
if([[app bundleIdentifier] isEqualToString:@"fm.last.Last.fm"]) {
running = YES;
break;
}
}
if(!running) {
[[NSWorkspace sharedWorkspace] launchApplication:@"Last.fm.app"];
}
}
_keepProcessingAudioScrobblerCommands = YES;