1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-22 04:10:07 +00:00

detect /sys/class/power_supply/cw2015-battery, do not use charge_counter

This commit is contained in:
wimh 2020-09-19 20:17:11 +02:00
parent 80d9e57388
commit fd38f96173

View file

@ -1270,7 +1270,7 @@ _p9k_prompt_battery_init() {
return return
fi fi
if [[ $_p9k_os != (Linux|Android) || if [[ $_p9k_os != (Linux|Android) ||
-z /sys/class/power_supply/(CMB*|BAT*|battery)/(energy_full|charge_full|charge_counter)(#qN) ]]; then -z /sys/class/power_supply/(CMB*|BAT*|*battery)/(energy_full|charge_full)(#qN) ]]; then
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='${:-}' typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='${:-}'
fi fi
} }
@ -1328,7 +1328,7 @@ _p9k_prompt_battery_set_args() {
Linux|Android) Linux|Android)
# See https://sourceforge.net/projects/acpiclient. # See https://sourceforge.net/projects/acpiclient.
local -a bats=( /sys/class/power_supply/(CMB*|BAT*|battery)/(FN) ) local -a bats=( /sys/class/power_supply/(CMB*|BAT*|*battery)/(FN) )
(( $#bats )) || return (( $#bats )) || return
local -i energy_now energy_full power_now local -i energy_now energy_full power_now
@ -1336,7 +1336,7 @@ _p9k_prompt_battery_set_args() {
local dir local dir
for dir in $bats; do for dir in $bats; do
local -i pow=0 full=0 local -i pow=0 full=0
if _p9k_read_file $dir/(energy_full|charge_full|charge_counter)(N); then if _p9k_read_file $dir/(energy_full|charge_full)(N); then
(( energy_full += ${full::=_p9k__ret} )) (( energy_full += ${full::=_p9k__ret} ))
fi fi
if _p9k_read_file $dir/(power|current)_now(N) && (( $#_p9k__ret < 9 )); then if _p9k_read_file $dir/(power|current)_now(N) && (( $#_p9k__ret < 9 )); then