batstat fix

This commit is contained in:
tavo 2025-06-14 11:43:21 -06:00
parent 7505f9fa87
commit 9e4d1f7eba

View file

@ -17,7 +17,7 @@ _bat_exists() {
# Find average value # Find average value
_bat_value() { _bat_value() {
[ "$(_bat_exists)" = 0 ] && return 1 [ "$(_bat_exists)" != 1 ] && return 1
info="$1" info="$1"
total=0 total=0
batteries=0 batteries=0
@ -34,7 +34,7 @@ _bat_value() {
# Find status string # Find status string
bat_status() { bat_status() {
[ "$(_bat_exists)" = 0 ] && return 1 [ "$(_bat_exists)" != 1 ] && return 1
for battery in "$_bat_info_dir"?* ; do for battery in "$_bat_info_dir"?* ; do
while read -r line; do while read -r line; do
echo "$line" echo "$line"
@ -45,7 +45,7 @@ bat_status() {
# Icon state # Icon state
bat_icon() { bat_icon() {
[ "$(_bat_exists)" = 0 ] && echo "󰚥" && return 0 [ "$(_bat_exists)" != 1 ] && echo "󰚥" && return 0
bat="$(_bat_value capacity)" bat="$(_bat_value capacity)"
# This is meant to be a constant string # This is meant to be a constant string
@ -121,7 +121,7 @@ bat_ttfh() {
# Time to full if charging, time to empty otherwise # Time to full if charging, time to empty otherwise
bat_atime() { bat_atime() {
[ "$(_bat_exists)" = 0 ] && return 1 [ "$(_bat_exists)" != 1 ] && return 1
if [ "$(bat_status)" = "Charging" ]; then if [ "$(bat_status)" = "Charging" ]; then
bat_ttf bat_ttf
else else
@ -131,7 +131,7 @@ bat_atime() {
# Like bat_atime, human readable # Like bat_atime, human readable
bat_atimeh() { bat_atimeh() {
[ "$(_bat_exists)" = 0 ] && return 1 [ "$(_bat_exists)" != 1 ] && return 1
if [ "$(bat_status)" = "Charging" ]; then if [ "$(bat_status)" = "Charging" ]; then
bat_ttfh bat_ttfh
else else