mamburu: Only launch last.fm client if it isn't already running (prevents last.fm client's window from popping up on Cog restarts)
parent
73524776e7
commit
d98b5549d1
|
@ -72,10 +72,23 @@ escapeForLastFM(NSString *string)
|
|||
if((self = [super init])) {
|
||||
|
||||
_pluginID = @"cog";
|
||||
|
||||
if([[NSUserDefaults standardUserDefaults] boolForKey:@"automaticallyLaunchLastFM"])
|
||||
[[NSWorkspace sharedWorkspace] launchApplication:@"Last.fm.app"];
|
||||
|
||||
|
||||
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;
|
||||
|
||||
kern_return_t result = semaphore_create(mach_task_self(), &_semaphore, SYNC_POLICY_FIFO, 0);
|
||||
|
|
Loading…
Reference in New Issue