mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-04-10 17:47:19 +00:00
Allows auto-launch for every user's build
This commit is contained in:
parent
9c4b4ac39e
commit
670bfb17d5
@ -9,7 +9,7 @@ protocol AgentStatusCheckerProtocol: ObservableObject {
|
||||
class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol {
|
||||
|
||||
@Published var running: Bool = false
|
||||
let bundleID = Bundle.main.bundleIdentifier?.replacingOccurrences(of: "Host", with: "SecretAgent")
|
||||
let bundleID = Bundle.main.bundleIdentifier!.replacingOccurrences(of: "Host", with: "SecretAgent")
|
||||
|
||||
init() {
|
||||
check()
|
||||
@ -21,7 +21,7 @@ class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol {
|
||||
|
||||
// All processes, including ones from older versions, etc
|
||||
var secretAgentProcesses: [NSRunningApplication] {
|
||||
NSRunningApplication.runningApplications(withBundleIdentifier: bundleID ?? "com.maxgoedjen.Secretive.SecretAgent")
|
||||
NSRunningApplication.runningApplications(withBundleIdentifier: bundleID )
|
||||
}
|
||||
|
||||
// The process corresponding to this instance of Secretive
|
||||
|
@ -4,7 +4,8 @@ import AppKit
|
||||
import OSLog
|
||||
|
||||
struct LaunchAgentController {
|
||||
|
||||
|
||||
let bundleID = Bundle.main.bundleIdentifier!.replacingOccurrences(of: "Host", with: "SecretAgent")
|
||||
func install(completion: (() -> Void)? = nil) {
|
||||
Logger().debug("Installing agent")
|
||||
_ = setEnabled(false)
|
||||
@ -32,7 +33,7 @@ struct LaunchAgentController {
|
||||
}
|
||||
|
||||
private func setEnabled(_ enabled: Bool) -> Bool {
|
||||
SMLoginItemSetEnabled("com.maxgoedjen.Secretive.SecretAgent" as CFString, enabled)
|
||||
SMLoginItemSetEnabled(bundleID as CFString, enabled)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user