Initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// LaunchAtLogin.swift
|
||||
// GreenshotMac
|
||||
|
||||
import Foundation
|
||||
import ServiceManagement
|
||||
|
||||
enum LaunchAtLogin {
|
||||
static var isEnabled: Bool {
|
||||
get { SMAppService.mainApp.status == .enabled }
|
||||
set {
|
||||
do {
|
||||
if newValue {
|
||||
if SMAppService.mainApp.status != .enabled {
|
||||
try SMAppService.mainApp.register()
|
||||
}
|
||||
} else {
|
||||
if SMAppService.mainApp.status == .enabled {
|
||||
try SMAppService.mainApp.unregister()
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
NSLog("GreenshotMac: could not change launch at login: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user