Given that you're already familiar with -[NSWorkspace runningApplications]
, why don't you just iterate over those and check which ones meet your criteria? The background only
property corresponds to NSRunningApplication
's activationPolicy
property being something other than NSApplicationActivationPolicyRegular
.
So, something like (not tested):
NSArray* apps = [[NSWorkspace sharedWorkspace] runningApplications];
NSIndexSet* indexes = [apps indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop){
return [obj activationPolicy] == NSApplicationActivationPolicyRegular;
}];
NSArray* names = [[apps objectsAtIndexes:indexes] valueForKey:@"localizedName"];