Files
Snaggle/GreenshotMac/Core/LaunchAtLogin.swift
T
2026-09-17 15:15:45 -05:00

27 lines
753 B
Swift

// 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)")
}
}
}
}