Compare commits

..

No commits in common. "master" and "v1.9.2" have entirely different histories.

1 changed files with 2 additions and 5 deletions

View File

@ -9,7 +9,6 @@ PATH="/usr/bin:/usr/local/bin:/usr/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/op
usage() {
cat << EOF
usage: ${0##*/} [command]
charging [on|off] - Toggle charging
adapter [on|off] - Toggle adapter connection
status - Get status information
@ -28,7 +27,7 @@ read_cache() {
}
log_message() {
timestamp=$(date "+%b %d %H:%M:%S")
local timestamp=$(date "+%b %d %H:%M:%S")
echo "$timestamp - $1"
}
@ -43,14 +42,12 @@ disable_discharging() {
}
enable_charging() {
[[ "$(get_smc_charging_hex)" == "00" ]] && return
log_message "Enabling battery charging"
sudo smc -k CH0B -w 00
sudo smc -k CH0C -w 00
}
disable_charging() {
[[ "$(get_smc_charging_hex)" != "00" ]] && return
log_message "Disabling battery charging"
sudo smc -k CH0B -w 02
sudo smc -k CH0C -w 02
@ -143,7 +140,7 @@ runScript() {
"status")
case "$setting" in
"charging") exit "$(get_smc_charging_hex)" ;;
"cache") get_cached_status ;;
"cache") echo "$(get_cached_status)" ;;
*) echo "Battery at $(get_battery_percentage)%, smc charging $(get_smc_charging_status)" ;;
esac
;;