2018-06-30 14:13:58 +07:00
2018-06-30 14:13:58 +07:00
2018-06-30 01:08:40 +07:00
2018-03-31 07:06:28 +07:00
2017-07-30 19:11:13 +02:00
2018-06-30 01:08:40 +07:00
2017-07-30 19:11:13 +02:00
2018-05-05 00:06:25 +07:00
2018-06-30 14:13:58 +07:00
2017-07-30 19:11:13 +02:00
2018-06-30 14:08:31 +07:00

LaunchAtLogin

Add "Launch at Login" functionality to your sandboxed macOS app in seconds

It's usually quite a convoluted and error-prone process to add this. No more!

It's App Store compatible and used in my Lungo and Battery Indicator app.

You might also find my create-dmg project useful.

Requirements

  • macOS 10.12+
  • Xcode 9.3+
  • Swift 4.1+

Install

Carthage

github "sindresorhus/LaunchAtLogin"

CocoaPods

pod 'LaunchAtLogin'

Usage

Add a new "Run Script Phase" below "Embed Frameworks" in "Build Phases" with the following:

./Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh

Use it in your app:

import LaunchAtLogin

print(LaunchAtLogin.isEnabled)
//=> false

LaunchAtLogin.isEnabled = true

print(LaunchAtLogin.isEnabled)
//=> true

Note that the Mac App Store guidelines requires "launch at login" functionality to be enabled in response to a user action. This is usually solved by making it a preference that is disabled by default.

How does it work?

The framework bundles the helper app needed to launch your app and copies it into your app at build time.

  • Defaults - Swifty and modern UserDefaults
  • Preferences - Add a preferences window to your macOS app in minutes
  • DockProgress - Show progress in your app's Dock icon

License

MIT © Sindre Sorhus

S
Description
Add “Launch at Login” functionality to your macOS app in seconds
Readme
6.6 MiB
Languages
Swift 62.7%
Shell 35.5%
Objective-C 1.8%