So I have an app that runs shell command twice, once to disable sleep and then a few moments later to enable sleep. The code looks as follows:
NSAppleScript(source: "do shell script \"sudo pmset -a disablesleep 1\" with administrator " +
"privileges")!.executeAndReturnError(nil)
// and then same code with with '0' instead of 1 to disable it
However the issue is I don't want the user to enter their password EVERYTIME they call these commands. It's making for a poor user experience. Is there a way I can grant the entire app admin privilege and run shell commands however I want? Or is there a way to run this shell command without the user authorization?