https://github.com/inket/startatlogin
Swifty Start at Login for macOS apps
https://github.com/inket/startatlogin
carthage framework macos start-at-login swift
Last synced: 5 months ago
JSON representation
Swifty Start at Login for macOS apps
- Host: GitHub
- URL: https://github.com/inket/startatlogin
- Owner: inket
- License: mit
- Created: 2016-12-11T11:51:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-07-08T06:32:42.000Z (over 2 years ago)
- Last Synced: 2024-11-11T07:20:08.561Z (about 1 year ago)
- Topics: carthage, framework, macos, start-at-login, swift
- Language: Objective-C
- Homepage:
- Size: 24.4 KB
- Stars: 23
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## StartAtLogin 
StartAtLogin is a framework for Swift macOS apps looking to add a "Start at Login" feature with minimal work.
Current solutions require a significant amount of steps to implement, with lots of variables and frequently imprecise instructions. StartAtLogin gets rid of that:

StartAtLogin is App Store-approved and is currently being used in the app [stts](https://itunes.apple.com/app/stts/id1187772509?ls=1&mt=12)
### Usage
Add StartAtLogin via Carthage:
__Cartfile__
```
github "inket/StartAtLogin"
```
Add a new build phase "Run Script Phase" to your app, with the following script:
```sh
FRAMEWORKS_HELPER_PATH="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/StartAtLogin.framework/Versions/A/Resources/StartAtLoginHelper.app"
HELPER_DIR="$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems"
HELPER_PATH="$HELPER_DIR/StartAtLoginHelper.app"
mkdir -p "$HELPER_DIR"
rm -rf "$HELPER_PATH"
cp -rf "$FRAMEWORKS_HELPER_PATH" "$HELPER_DIR/"
if [ "$CONFIGURATION" == "Release" ]; then
rm -rf "$FRAMEWORKS_HELPER_PATH"
fi
defaults write "$HELPER_PATH/Contents/Info" CFBundleIdentifier -string "$PRODUCT_BUNDLE_IDENTIFIER-StartAtLoginHelper"
codesign --force --entitlements "$CODE_SIGN_ENTITLEMENTS" -s "$EXPANDED_CODE_SIGN_IDENTITY_NAME" -v "$HELPER_PATH"
```
Use StartAtLogin in your app:
```swift
import StartAtLogin
// Enable
StartAtLogin.enabled = true
// Disable
StartAtLogin.enabled = false
// Check status
debugPrint(StartAtLogin.enabled)
```
#### Contact
[@inket](https://github.com/inket) / [@inket](https://twitter.com/inket) on Twitter / [mahdi.jp](https://mahdi.jp)