diff options
author | Teddy Wing | 2016-12-02 13:00:19 -0500 |
---|---|---|
committer | Teddy Wing | 2016-12-02 13:00:19 -0500 |
commit | a77a053f90a7b2588dbaabedbf25f908680f2f30 (patch) | |
tree | b1dcf8706c1e6a82e8505f2fa09dc22e0a197ecd /Low Battery Yup/LaunchAgentManager.h | |
parent | 055471fad0187e654302034a0875a417e73e089f (diff) | |
download | Low-Battery-Yup-a77a053f90a7b2588dbaabedbf25f908680f2f30.tar.bz2 |
Add "Start at login" checkbox that [un]installs launch agent
A new checkbox in the UI that asks whether the app should start at
login. Checking and unchecking the box moves a LaunchAgent plist into
and out of `~/Library/LaunchAgents/`. This plist file will define
instructions to start the daemon on login.
Also add a `DaemonLauncher` class that will launch or quit the daemon
when the checkbox is clicked.
Bug:
Currently the app always starts with the checkbox checked. That's not
what should happen. Instead, we should save the checkbox value to
`NSUserDefaults` so that it has the previous value when the program is
launched.
Diffstat (limited to 'Low Battery Yup/LaunchAgentManager.h')
-rw-r--r-- | Low Battery Yup/LaunchAgentManager.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Low Battery Yup/LaunchAgentManager.h b/Low Battery Yup/LaunchAgentManager.h new file mode 100644 index 0000000..5a9fa44 --- /dev/null +++ b/Low Battery Yup/LaunchAgentManager.h @@ -0,0 +1,20 @@ +// +// LaunchAgentManager.h +// Low Battery Yup.d +// +// Created by TW on 12/2/16. +// Copyright (c) 2016 TW. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#define LAUNCH_AGENTS_PATH @"~/Library/LaunchAgents" + +@interface LaunchAgentManager : NSObject { + NSFileManager *_file_manager; +} + +- (BOOL)install; +- (BOOL)uninstall; + +@end |