mirror of
https://github.com/maxgoedjen/secretive.git
synced 2024-11-26 07:27:07 +00:00
20 lines
380 B
Swift
20 lines
380 B
Swift
|
import Foundation
|
||
|
import ServiceManagement
|
||
|
|
||
|
struct LaunchAgentController {
|
||
|
|
||
|
func install() -> Bool {
|
||
|
setEnabled(true)
|
||
|
}
|
||
|
|
||
|
func relaunch() {
|
||
|
_ = setEnabled(false)
|
||
|
_ = setEnabled(true)
|
||
|
}
|
||
|
|
||
|
private func setEnabled(_ enabled: Bool) -> Bool {
|
||
|
SMLoginItemSetEnabled("com.maxgoedjen.Secretive.SecretAgent" as CFString, enabled)
|
||
|
}
|
||
|
|
||
|
}
|