CloverBootloader/CloverApp/Clover/RunAtLogin.swift
vectorsigma72 97ccb4840a Clover.app v1 Alpha
Agent application (macOS 10.11+).  More info at https://www.insanelymac.com/forum/topic/341047-cloverapp-testing/
2019-11-06 23:58:10 +01:00

25 lines
625 B
Swift

//
// RunAtLogin.swift
// HWMonitorSMC
//
// Created by vector sigma on 18/03/18.
// Copyright © 2018 HWSensor. All rights reserved.
//
import Cocoa
import ServiceManagement
extension AppDelegate {
func setLaunchAtStartup() {
let success : Bool = SMLoginItemSetEnabled(gHelperID, true)
UserDefaults.standard.set(success, forKey: kRunAtLogin)
UserDefaults.standard.synchronize()
}
func removeLaunchAtStartup() {
let success : Bool = SMLoginItemSetEnabled(gHelperID, false)
UserDefaults.standard.set(success ? false : true, forKey: kRunAtLogin)
UserDefaults.standard.synchronize()
}
}