diff --git a/widgets/battery.go b/widgets/battery.go index d8334bb..4a8dcbf 100644 --- a/widgets/battery.go +++ b/widgets/battery.go @@ -91,6 +91,9 @@ func (b *BatteryWidget) update() { } } for i, battery := range batteries { + if battery.Full == 0.0 { + continue + } id := makeID(i) perc := battery.Current / battery.Full percentFull := math.Abs(perc) * 100.0 diff --git a/widgets/batterygauge.go b/widgets/batterygauge.go index 20d92d4..3a89590 100644 --- a/widgets/batterygauge.go +++ b/widgets/batterygauge.go @@ -49,7 +49,6 @@ func (b *BatteryGauge) update() { log.Printf("error setting up batteries: %v", err) errLogged = true } - return } if len(bats) < 1 { b.Label = fmt.Sprintf("N/A") @@ -60,6 +59,9 @@ func (b *BatteryGauge) update() { charging := "%d%% ⚡%s" rate := 0.0 for _, bat := range bats { + if bat.Full == 0.0 { + continue + } mx += bat.Full cu += bat.Current if rate < bat.ChargeRate {