From 0b3c6bfe92158775f21eeac29b2f18051889c210 Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Wed, 10 Apr 2024 11:22:26 +0200 Subject: [PATCH] Fix more bugs --- cbattery | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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"