// Thin wrapper around the modern login-item API, toggled from the Manage // window's Settings tab. Standard, expected baseline behavior for a // persistent menu-bar utility that's otherwise easy to forget to reopen // after a restart. import ServiceManagement enum LaunchAtLogin { static var isEnabled: Bool { SMAppService.mainApp.status == .enabled } static func enable() throws { guard SMAppService.mainApp.status != .enabled else { return } try SMAppService.mainApp.register() } static func disable() throws { guard SMAppService.mainApp.status == .enabled else { return } try SMAppService.mainApp.unregister() } }