dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

commit 3fa40cf96e9c21b51f13ae2ef522edc74ff3466f
parent 532a16ba23a6b52b059193054b9e269626667006
Author: Chris Noxz <chris@noxz.tech>
Date:   Fri, 24 Apr 2020 11:31:12 +0200

[bin] fix issue with x220 using both charge_* and energy_* for battery

Diffstat:
Mbin/.local/bin/status.tmux | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bin/.local/bin/status.tmux b/bin/.local/bin/status.tmux @@ -10,8 +10,12 @@ mem) battery) _PATH="/sys/class/power_supply/BAT0" _STATUS="$(cat "$_PATH/status")" - _FULL="$(cat "$_PATH/energy_full")" - _NOW="$(cat "$_PATH/energy_now")" + _FULL="$([ -f "$_PATH/charge_full" ] \ + && cat "$_PATH/charge_full" \ + || cat "$_PATH/energy_full")" + _NOW="$([ -f "$_PATH/charge_now" ] \ + && cat "$_PATH/charge_now" \ + || cat "$_PATH/energy_now")" [ "$_STATUS" = "Discharging" ] && _STATUS="-" || _STATUS="+" echo "$_STATUS$((100 * _NOW / _FULL))%"