mirror of https://github.com/aristocratos/bpytop
🔋 battery symbol status changed to a dictionary
parent
9e38b8fd58
commit
509c962e61
13
bpytop.py
13
bpytop.py
|
@ -1707,14 +1707,11 @@ class CpuBox(Box, SubBox):
|
||||||
battery_time = ""
|
battery_time = ""
|
||||||
if not hasattr(Meters, "battery") or cls.resized:
|
if not hasattr(Meters, "battery") or cls.resized:
|
||||||
Meters.battery = Meter(cls.battery_percent, 10, "cpu", invert=True)
|
Meters.battery = Meter(cls.battery_percent, 10, "cpu", invert=True)
|
||||||
if cls.battery_status == "Charging":
|
batery_symbols = {"Charging": "â–²",
|
||||||
battery_symbol: str = "â–²"
|
"Discharging": "â–¼",
|
||||||
elif cls.battery_status == "Discharging":
|
"Full": "â– ",
|
||||||
battery_symbol = "â–¼"
|
"Not charging": "â– "}
|
||||||
elif cls.battery_status in ["Full", "Not charging"]:
|
battery_symbol: str = battery_symbols.get(cls.battery_status, "â—‹")
|
||||||
battery_symbol = "â– "
|
|
||||||
else:
|
|
||||||
battery_symbol = "â—‹"
|
|
||||||
battery_len: int = len(f'{CONFIG.update_ms}') + (11 if cls.width >= 100 else 0) + len(battery_time) + len(f'{cls.battery_percent}')
|
battery_len: int = len(f'{CONFIG.update_ms}') + (11 if cls.width >= 100 else 0) + len(battery_time) + len(f'{cls.battery_percent}')
|
||||||
battery_pos = cls.width - battery_len - 17
|
battery_pos = cls.width - battery_len - 17
|
||||||
if (battery_pos != cls.old_battery_pos or battery_len != cls.old_battery_len) and cls.old_battery_pos > 0 and not cls.resized:
|
if (battery_pos != cls.old_battery_pos or battery_len != cls.old_battery_len) and cls.old_battery_pos > 0 and not cls.resized:
|
||||||
|
|
Loading…
Reference in New Issue