🔋 battery symbol status changed to a dictionary

pull/162/head
David Perez-Suarez 2020-10-24 18:30:32 +01:00
parent 9e38b8fd58
commit 509c962e61
1 changed files with 5 additions and 8 deletions

View File

@ -1707,14 +1707,11 @@ class CpuBox(Box, SubBox):
battery_time = ""
if not hasattr(Meters, "battery") or cls.resized:
Meters.battery = Meter(cls.battery_percent, 10, "cpu", invert=True)
if cls.battery_status == "Charging":
battery_symbol: str = "â–²"
elif cls.battery_status == "Discharging":
battery_symbol = "â–¼"
elif cls.battery_status in ["Full", "Not charging"]:
battery_symbol = "â– "
else:
battery_symbol = "â—‹"
batery_symbols = {"Charging": "â–²",
"Discharging": "â–¼",
"Full": "â– ",
"Not charging": "â– "}
battery_symbol: str = battery_symbols.get(cls.battery_status, "â—‹")
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
if (battery_pos != cls.old_battery_pos or battery_len != cls.old_battery_len) and cls.old_battery_pos > 0 and not cls.resized: