Refactor and Rename to CommandNotch

This commit is contained in:
2026-03-07 23:14:31 +11:00
parent 2bf1cbad2a
commit 5d161bb214
45 changed files with 76 additions and 69 deletions

View File

@@ -0,0 +1,24 @@
import ServiceManagement
/// Registers / unregisters the app as a login item using the
/// modern SMAppService API (macOS 13+).
enum LaunchAtLoginHelper {
static func setEnabled(_ enabled: Bool) {
let service = SMAppService.mainApp
do {
if enabled {
try service.register()
} else {
try service.unregister()
}
} catch {
print("[LaunchAtLogin] Failed to \(enabled ? "register" : "unregister"): \(error)")
}
}
/// Reads the current registration state from the system.
static var isEnabled: Bool {
SMAppService.mainApp.status == .enabled
}
}