From d3f8a2f11de8c0cd1697c12386011421bad081ef Mon Sep 17 00:00:00 2001 From: aristocratos Date: Sun, 13 Sep 2020 16:30:16 +0200 Subject: [PATCH] Added symbol for battery inactive --- bpytop.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bpytop.py b/bpytop.py index 8c6d1e4..614c931 100755 --- a/bpytop.py +++ b/bpytop.py @@ -1633,7 +1633,10 @@ class CpuBox(Box, SubBox): battery_time = "" if not hasattr(Meters, "battery") or cls.resized: Meters.battery = Meter(cls.battery_percent, 10, "cpu", invert=True) - battery_symbol: str = "▼" if not psutil.sensors_battery().power_plugged else "▲" + if psutil.sensors_battery().power_plugged: + battery_symbol: str = "▲" if cls.battery_percent < 100 else "■" + else: + battery_symbol = "▼" battery_pos = cls.width - len(f'{CONFIG.update_ms}') - 17 - (11 if cls.width >= 100 else 0) - len(battery_time) - len(f'{cls.battery_percent}') if battery_pos != cls.old_battery_pos and cls.old_battery_pos > 0 and not cls.resized: out += f'{Mv.to(y-1, cls.old_battery_pos)}{THEME.cpu_box(Symbol.h_line*(15 if cls.width >= 100 else 5))}'