mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-04-20 06:22:12 +00:00
Completion
This commit is contained in:
parent
f2092e597a
commit
a3ed59a78c
@ -40,11 +40,12 @@ struct Secretive: App {
|
|||||||
if hasRunSetup && !agentStatusChecker.running {
|
if hasRunSetup && !agentStatusChecker.running {
|
||||||
// We've run setup, we didn't just update, launchd is just not doing it's thing.
|
// We've run setup, we didn't just update, launchd is just not doing it's thing.
|
||||||
// Force a launch directly.
|
// Force a launch directly.
|
||||||
LaunchAgentController().forceLaunch()
|
LaunchAgentController().forceLaunch { _ in
|
||||||
agentStatusChecker.check()
|
agentStatusChecker.check()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.commands {
|
.commands {
|
||||||
CommandGroup(after: CommandGroupPlacement.newItem) {
|
CommandGroup(after: CommandGroupPlacement.newItem) {
|
||||||
Button("New Secret") {
|
Button("New Secret") {
|
||||||
|
@ -11,10 +11,11 @@ struct LaunchAgentController {
|
|||||||
return setEnabled(true)
|
return setEnabled(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func forceLaunch() {
|
func forceLaunch(completion: ((Bool) -> Void)?) {
|
||||||
Logger().debug("Agent is not running, attempting to force launch")
|
Logger().debug("Agent is not running, attempting to force launch")
|
||||||
let url = Bundle.main.bundleURL.appendingPathComponent("Contents/Library/LoginItems/SecretAgent.app")
|
let url = Bundle.main.bundleURL.appendingPathComponent("Contents/Library/LoginItems/SecretAgent.app")
|
||||||
NSWorkspace.shared.openApplication(at: url, configuration: NSWorkspace.OpenConfiguration()) { app, error in
|
NSWorkspace.shared.openApplication(at: url, configuration: NSWorkspace.OpenConfiguration()) { app, error in
|
||||||
|
completion?(error == nil)
|
||||||
if let error = error {
|
if let error = error {
|
||||||
Logger().error("Error force launching \(error.localizedDescription)")
|
Logger().error("Error force launching \(error.localizedDescription)")
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user