refactor: split utilities

This commit is contained in:
Peter Steinberger
2025-12-24 22:16:06 +01:00
parent 8ee62f0ac8
commit 88be2701f4
6 changed files with 236 additions and 232 deletions
@@ -0,0 +1,20 @@
import Foundation
enum LaunchdManager {
private static func runLaunchctl(_ args: [String]) {
let process = Process()
process.launchPath = "/bin/launchctl"
process.arguments = args
try? process.run()
}
static func startClawdis() {
let userTarget = "gui/\(getuid())/\(launchdLabel)"
self.runLaunchctl(["kickstart", "-k", userTarget])
}
static func stopClawdis() {
let userTarget = "gui/\(getuid())/\(launchdLabel)"
self.runLaunchctl(["stop", userTarget])
}
}