Forked from madrobby/gist:9f134c440bd6524e7e7a
Last active
November 25, 2020 19:39
-
-
Save joshuatbrown/83b6bafcbeca94f43c60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(BOOL)appIsPresentInLoginItems | |
{ | |
NSString *bundleID = @"blah"; | |
NSArray *jobDicts = (__bridge NSArray *)SMCopyAllJobDictionaries( kSMDomainUserLaunchd ); | |
NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { | |
return [[evaluatedObject valueForKey:@"Label"] isEqualToString:bundleID] && [[evaluatedObject valueForKey:@"OnDemand"] boolValue]; | |
}]; | |
return [[jobDicts filteredArrayUsingPredicate:predicate] count] >= 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HELPER_BUNDLE_ID = 'blah' | |
def launchesAtLogin? | |
SMCopyAllJobDictionaries(KSMDomainUserLaunchd).any? do |job| | |
job['Label'] == HELPER_BUNDLE_ID && job['OnDemand'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment