This commit is contained in:
sankalp committed 2025-02-16 15:35:10 +05:45
1 parent 7f81029c37
commit a77df7e7fd
2 files changed
+15 -4

No files matched your search

+4 -2
View File
@@ -2,6 +2,7 @@ import psutil
from fabric import Fabricator from fabric import Fabricator
from fabric.widgets.box import Box from fabric.widgets.box import Box
from fabric.widgets.overlay import Overlay from fabric.widgets.overlay import Overlay
from fabric.widgets.label import Label
from fabric.widgets.circularprogressbar import CircularProgressBar from fabric.widgets.circularprogressbar import CircularProgressBar
from snippets import MaterialIcon from snippets import MaterialIcon
@@ -54,12 +55,13 @@ class BatteryLabel(Box):
) )
self.battery_overlay = Overlay(child=self.progress_bar, overlays=battery_icon) 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) battery_percent = round(battery.percent)
self.progress_bar.value = battery_percent / 100 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( self.set_tooltip_text(
f"Battery: {battery_percent}%\nStatus: {'Charging' if is_charging else 'Discharging'}" f"Battery: {battery_percent}%\nStatus: {'Charging' if is_charging else 'Discharging'}"
+11 -2
View File
@@ -51,9 +51,18 @@
/* /*
* ── battery ─────────────────────────────────────────────────────────── * ── battery ───────────────────────────────────────────────────────────
*/ */
#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;
} }
/* /*