Skip to content

Commit

Permalink
Call libkrbn_services_register_core_daemons and libkrbn_services_regi…
Browse files Browse the repository at this point in the history
…ster_core_agents in ServicesMonitor
  • Loading branch information
tekezo committed May 29, 2024
1 parent 1ce3012 commit 875da14
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/apps/SettingsWindow/src/ServicesMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@ public class ServicesMonitor {
withTimeInterval: 3.0,
repeats: true
) { (_: Timer) in
ContentViewStates.shared.showServicesNotRunningAlert =
!libkrbn_services_grabber_daemon_running()
let servicesRunning = libkrbn_services_grabber_daemon_running()

ContentViewStates.shared.showServicesNotRunningAlert = !servicesRunning

if !servicesRunning {
// For approved services, once they are disabled from System Settings > General > Login Items,
// re-enabling them will not automatically start the service, and it is necessary to call SMAppService.register again.
// Therefore, if the service is not running, periodically register daemons and agents to restart them after enabled.
libkrbn_services_register_core_daemons()
libkrbn_services_register_core_agents()
}
}

timer?.fire()
Expand Down

0 comments on commit 875da14

Please sign in to comment.