Rewrite for correct `KeepAlive`

`KeepAlive` was handled at the `LaunchAgent`-level which caused the
console to fill up with nonsense. I've moved it to the AppleScript,
which was almost a complete rewrite. Not quite happy about the
cleanliness of the code, but it runs.