From a77df7e7fdb7a261749e64377378dec9258eb543 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sun, 16 Feb 2025 15:35:10 +0545 Subject: [PATCH] updates --- modules/bar/components/battery.py | 6 ++++-- styles/bar.css | 13 +++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/bar/components/battery.py b/modules/bar/components/battery.py index 2dd55b8..6cb90d4 100644 --- a/modules/bar/components/battery.py +++ b/modules/bar/components/battery.py @@ -2,6 +2,7 @@ import psutil from fabric import Fabricator from fabric.widgets.box import Box from fabric.widgets.overlay import Overlay +from fabric.widgets.label import Label from fabric.widgets.circularprogressbar import CircularProgressBar from snippets import MaterialIcon @@ -54,12 +55,13 @@ class BatteryLabel(Box): ) self.battery_overlay = Overlay(child=self.progress_bar, overlays=battery_icon) + self.battery_label = Label(label=f"{battery_percent}%", name="battery-label") - self.children = self.battery_overlay + self.children = self.battery_label, self.battery_overlay battery_percent = round(battery.percent) self.progress_bar.value = battery_percent / 100 - # self.show() if battery_percent < 100 else self.hide() + self.show() if battery_percent < 100 else self.hide() self.set_tooltip_text( f"Battery: {battery_percent}%\nStatus: {'Charging' if is_charging else 'Discharging'}" diff --git a/styles/bar.css b/styles/bar.css index 97322e8..028ba7a 100644 --- a/styles/bar.css +++ b/styles/bar.css @@ -51,9 +51,18 @@ /* * ── battery ─────────────────────────────────────────────────────────── */ - #battery { - padding: 0 0 0 4px; + background-color: @surfaceContainer; + border-radius: 100px; + padding: 2px 10px 2px 10px; +} + +#battery label { + font-weight: 600; +} + +#battery-label { + margin-right: 5px; } /*