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 hidden or 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 = nil; | |
jobDicts = (NSArray *)SMCopyAllJobDictionaries( kSMDomainUserLaunchd ); | |
if ( (jobDicts != nil) && [jobDicts count] > 0 ) { | |
BOOL bOnDemand = NO; | |
for ( NSDictionary * job in jobDicts ) { | |
if ( [bundleID isEqualToString:[job objectForKey:@"Label"]] ) { | |
bOnDemand = [[job objectForKey:@"OnDemand"] boolValue]; | |
break; | |
} | |
} | |
CFRelease((CFDictionaryRef)jobDicts); jobDicts = nil; | |
return bOnDemand; | |
} | |
return NO; | |
} |
This file contains hidden or 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