Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kgn committed Apr 20, 2012
0 parents commit 319878f
Show file tree
Hide file tree
Showing 20 changed files with 4,288 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
xcuserdata
16 changes: 16 additions & 0 deletions LLManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// LLManager.h
// LaunchAtLogin
//
// Created by David Keegan on 4/20/12.
// Copyright (c) 2012 David Keegan. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface LLManager : NSObject

+ (BOOL)launchAtLogin;
+ (void)setLaunchAtLogin:(BOOL)value;

@end
38 changes: 38 additions & 0 deletions LLManager.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// LLManager.m
// LaunchAtLogin
//
// Created by David Keegan on 4/20/12.
// Copyright (c) 2012 David Keegan. All rights reserved.
//

#import "LLManager.h"
#import "LLStrings.h"
#import <ServiceManagement/ServiceManagement.h>

@implementation LLManager

+ (BOOL)launchAtLogin{
BOOL launch = NO;
NSArray *jobs = (NSArray *)SMCopyAllJobDictionaries(kSMDomainUserLaunchd);
if([jobs count]){
for(NSDictionary *job in jobs){
if([[job objectForKey:@"Label"] isEqualToString:LLHelperBundleIdentifier]){
launch = [[job objectForKey:@"OnDemand"] boolValue];
break;
}
}
}
#if !__has_feature(objc_arc)
[jobs release], jobs = nil;
#endif
return launch;
}

+ (void)setLaunchAtLogin:(BOOL)value{
if(!SMLoginItemSetEnabled((CFStringRef)LLHelperBundleIdentifier, value)){
NSLog(@"SMLoginItemSetEnabled failed!");
}
}

@end
5 changes: 5 additions & 0 deletions LLStrings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// strings used by LLManager and LaunchAtLoginHelper
//

#define LLURLScheme @"launchatloginsample"
#define LLHelperBundleIdentifier @"com.github.kgn.LaunchAtLoginHelper"
237 changes: 237 additions & 0 deletions LaunchAtLoginHelper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
734C379915414CE200994189 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 734C379815414CE200994189 /* Cocoa.framework */; };
73C920E915414E7800C2A75A /* LLHAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 73C920E615414E7800C2A75A /* LLHAppDelegate.m */; };
73C920EA15414E7800C2A75A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 73C920E715414E7800C2A75A /* main.m */; };
73C920EB15414E7800C2A75A /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 73C920E815414E7800C2A75A /* MainMenu.xib */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
734C379415414CE200994189 /* LaunchAtLoginHelper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LaunchAtLoginHelper.app; sourceTree = BUILT_PRODUCTS_DIR; };
734C379815414CE200994189 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
734C379B15414CE200994189 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
734C379D15414CE200994189 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
73C920E515414E7800C2A75A /* LLHAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLHAppDelegate.h; path = LaunchAtLoginHelper/LLHAppDelegate.h; sourceTree = "<group>"; };
73C920E615414E7800C2A75A /* LLHAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LLHAppDelegate.m; path = LaunchAtLoginHelper/LLHAppDelegate.m; sourceTree = "<group>"; };
73C920E715414E7800C2A75A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = LaunchAtLoginHelper/main.m; sourceTree = "<group>"; };
73C920E815414E7800C2A75A /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MainMenu.xib; path = LaunchAtLoginHelper/MainMenu.xib; sourceTree = "<group>"; };
73C920FA15414F7000C2A75A /* LLStrings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLStrings.h; sourceTree = SOURCE_ROOT; };
73C920FB15414FC900C2A75A /* LaunchAtLoginHelper.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = LaunchAtLoginHelper.entitlements; path = LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
734C379115414CE200994189 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
734C379915414CE200994189 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
734C378915414CE200994189 = {
isa = PBXGroup;
children = (
73C920E715414E7800C2A75A /* main.m */,
73C920FA15414F7000C2A75A /* LLStrings.h */,
73C920E515414E7800C2A75A /* LLHAppDelegate.h */,
73C920E615414E7800C2A75A /* LLHAppDelegate.m */,
73C920E815414E7800C2A75A /* MainMenu.xib */,
73C920FB15414FC900C2A75A /* LaunchAtLoginHelper.entitlements */,
734C379715414CE200994189 /* Frameworks */,
734C379515414CE200994189 /* Products */,
);
sourceTree = "<group>";
};
734C379515414CE200994189 /* Products */ = {
isa = PBXGroup;
children = (
734C379415414CE200994189 /* LaunchAtLoginHelper.app */,
);
name = Products;
sourceTree = "<group>";
};
734C379715414CE200994189 /* Frameworks */ = {
isa = PBXGroup;
children = (
734C379B15414CE200994189 /* AppKit.framework */,
734C379D15414CE200994189 /* Foundation.framework */,
734C379815414CE200994189 /* Cocoa.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
734C379315414CE200994189 /* LaunchAtLoginHelper */ = {
isa = PBXNativeTarget;
buildConfigurationList = 734C37B215414CE200994189 /* Build configuration list for PBXNativeTarget "LaunchAtLoginHelper" */;
buildPhases = (
734C379015414CE200994189 /* Sources */,
734C379115414CE200994189 /* Frameworks */,
734C379215414CE200994189 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = LaunchAtLoginHelper;
productName = LaunchAtLoginHelper;
productReference = 734C379415414CE200994189 /* LaunchAtLoginHelper.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
734C378B15414CE200994189 /* Project object */ = {
isa = PBXProject;
attributes = {
CLASSPREFIX = LLH;
LastUpgradeCheck = 0430;
ORGANIZATIONNAME = "David Keegan";
};
buildConfigurationList = 734C378E15414CE200994189 /* Build configuration list for PBXProject "LaunchAtLoginHelper" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 734C378915414CE200994189;
productRefGroup = 734C379515414CE200994189 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
734C379315414CE200994189 /* LaunchAtLoginHelper */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
734C379215414CE200994189 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
73C920EB15414E7800C2A75A /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
734C379015414CE200994189 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
73C920E915414E7800C2A75A /* LLHAppDelegate.m in Sources */,
73C920EA15414E7800C2A75A /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
734C37B015414CE200994189 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
734C37B115414CE200994189 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
734C37B315414CE200994189 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
INFOPLIST_FILE = "LaunchAtLoginHelper/LaunchAtLoginHelper-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
734C37B415414CE200994189 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
INFOPLIST_FILE = "LaunchAtLoginHelper/LaunchAtLoginHelper-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
734C378E15414CE200994189 /* Build configuration list for PBXProject "LaunchAtLoginHelper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
734C37B015414CE200994189 /* Debug */,
734C37B115414CE200994189 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
734C37B215414CE200994189 /* Build configuration list for PBXNativeTarget "LaunchAtLoginHelper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
734C37B315414CE200994189 /* Debug */,
734C37B415414CE200994189 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 734C378B15414CE200994189 /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions LaunchAtLoginHelper/LLHAppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// LLHAppDelegate.h
// LaunchAtLoginHelper
//
// Created by David Keegan on 4/20/12.
// Copyright (c) 2012 David Keegan. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface LLHAppDelegate : NSObject <NSApplicationDelegate>

@end
20 changes: 20 additions & 0 deletions LaunchAtLoginHelper/LLHAppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// LLHAppDelegate.m
// LaunchAtLoginHelper
//
// Created by David Keegan on 4/20/12.
// Copyright (c) 2012 David Keegan. All rights reserved.
//

#import "LLHAppDelegate.h"
#import "LLStrings.h"

@implementation LLHAppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)notification{
NSString *scheme = [NSString stringWithFormat:@"%@://", LLURLScheme];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:scheme]];
[NSApp terminate:self];
}

@end
36 changes: 36 additions & 0 deletions LaunchAtLoginHelper/LaunchAtLoginHelper-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.github.kgn.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>LSUIElement</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 David Keegan. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
8 changes: 8 additions & 0 deletions LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>
Loading

0 comments on commit 319878f

Please sign in to comment.