Skip to content

Instantly share code, notes, and snippets.

@joshuatbrown
Forked from madrobby/gist:9f134c440bd6524e7e7a
Last active November 25, 2020 19:39
Show Gist options
  • Save joshuatbrown/83b6bafcbeca94f43c60 to your computer and use it in GitHub Desktop.
Save joshuatbrown/83b6bafcbeca94f43c60 to your computer and use it in GitHub Desktop.
-(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;
}
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