Battery
Battery copied to clipboard
[Linux] bug in battery_charge()
The arch-ubuntu-suse flow looks buggy:
battery_state=$(cat $battery_path/energy_now)
battery_current=$battery_path/energy_now
...
if [ $battery_state == 'Discharging' ]; then
...
now=$(cat $battery_current)
full=$(cat $battery_full)
BATT_PCT=$((100 * $now / $full))
Note $now
is same as $battery_state
, yet the former is used in calculation while latter in string comparison.
Don't have a setup to verify this though.
I don't have a linux setup to verify this, could you open a PR with a fix and verify it? Otherwise I'll just close it down. 😢