This commit is contained in:
Santiago Lo Coco 2024-04-09 22:34:19 +02:00
parent f2c0820ef2
commit b9b96dcc07
2 changed files with 3 additions and 5 deletions

View File

@ -13,7 +13,7 @@ $(INSTALL_PATH): cbattery
uninstall: uninstall:
@echo "Removing cbattery from $(DESTDIR)" @echo "Removing cbattery from $(DESTDIR)"
@su $(USER) -c '$(DESTDIR)/cbattery revert' || (echo "Reverting cbattery configurations failed"; exit 1) @$(DESTDIR)/cbattery revert || (echo "Reverting cbattery configurations failed"; exit 1)
@rm -f $(INSTALL_PATH) @rm -f $(INSTALL_PATH)
help: help:

View File

@ -39,14 +39,12 @@ enable_charging() {
sudo smc -k CH0B -w 00 sudo smc -k CH0B -w 00
sudo smc -k CH0C -w 00 sudo smc -k CH0C -w 00
disable_discharging disable_discharging
write_cache "enabled"
} }
disable_charging() { disable_charging() {
echo "Disabling battery charging" echo "Disabling battery charging"
sudo smc -k CH0B -w 02 sudo smc -k CH0B -w 02
sudo smc -k CH0C -w 02 sudo smc -k CH0C -w 02
write_cache "disabled"
} }
get_smc_charging_hex() { get_smc_charging_hex() {
@ -106,8 +104,8 @@ runScript() {
"charging") "charging")
echo "Setting $action to $setting" echo "Setting $action to $setting"
case "$setting" in case "$setting" in
"on") enable_charging ;; "on") enable_charging && write_cache "enabled" ;;
"off") disable_charging ;; "off") disable_charging && write_cache "disabled" ;;
*) echo "Invalid option: $setting" ;; *) echo "Invalid option: $setting" ;;
esac esac
;; ;;