// // NSRunningApplication+NGA.m // SCMMenuExtra // // Created by Michael Bishop on 5/25/11. // Copyright 2011 Numerical Garden LLC. All rights reserved. // #import "NSRunningApplication+NGAAdditions.h" @implementation NSRunningApplication (NGAAdditions) +(NSRunningApplication*)foregroundApplication { NSDictionary * attributes = [[NSWorkspace sharedWorkspace] activeApplication]; NSNumber * foregroundPID = [attributes objectForKey:@"NSApplicationProcessIdentifier"]; return [NSRunningApplication runningApplicationWithProcessIdentifier:[foregroundPID intValue]]; } -(NSBundle*)bundle { return [NSBundle bundleWithURL:self.bundleURL]; } -(BOOL)isAgent { return [[[self.bundle infoDictionary] objectForKey:@"LSUIElement"] boolValue] == YES; } @end