Launch agent: disable autostart without killing running app

This commit is contained in:
Peter Steinberger
2025-12-07 19:01:01 +01:00
parent 8a8ac1ffe6
commit d73d571f19
10 changed files with 1821 additions and 1761 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,8 @@ enum LaunchAgentManager {
_ = self.runLaunchctl(["bootstrap", "gui/\(getuid())", self.plistURL.path])
_ = self.runLaunchctl(["kickstart", "-k", "gui/\(getuid())/\(launchdLabel)"])
} else {
_ = self.runLaunchctl(["bootout", "gui/\(getuid())/\(launchdLabel)"])
// Disable autostart going forward but leave the current app running.
// bootout would terminate the launchd job immediately (and crash the app if launched via agent).
try? FileManager.default.removeItem(at: self.plistURL)
}
}