diff --git a/cbattery b/cbattery index 847bf5e..0e8df5c 100755 --- a/cbattery +++ b/cbattery @@ -85,7 +85,7 @@ install_launch_daemon() { fi sudo cp "$share_plist" "$launch_daemon" sudo chown root:wheel "$launch_daemon" - sudo launchctl load "$launch_daemon" + sudo launchctl load -w "$launch_daemon" } get_cached_status() { @@ -113,6 +113,11 @@ runScript() { "revert") enable_charging disable_discharging + launch_daemon=/Library/LaunchDaemons/cbattery.plist + if [[ -f "$launch_daemon" ]]; then + sudo launchctl unload -w "$launch_daemon" + sudo rm "$launch_daemon" + fi ;; "charging") echo "Setting $action to $setting"