From 721eac0c5d3a418aa5226b7386c7540691d3ed8e Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sun, 10 Aug 2025 22:50:30 +0545 Subject: [PATCH] =?UTF-8?q?Reapply=20"=F0=9F=90=9B=20fix(panel):=20reduce?= =?UTF-8?q?=20icon=20size=20and=20hide=20battery=20indicator=20when=20no?= =?UTF-8?q?=20battery=20is=20detected"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3b119e7474cb50dd085e9e4b8a3b91d19ead15cf. --- modules/panel/components/indicators.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/panel/components/indicators.py b/modules/panel/components/indicators.py index c4fef35..b249e68 100644 --- a/modules/panel/components/indicators.py +++ b/modules/panel/components/indicators.py @@ -434,10 +434,13 @@ class BatteryIndicator(Box): def update_state(self): if not self.battery_service.is_present: - icon_file = "battery.svg" - tooltip = "No battery detected" - percentage_text = "N/A" + # Hide the entire battery component when no battery is present + self.set_visible(False) + return else: + # Show the battery component when battery is present + self.set_visible(True) + percentage = self.battery_service.percentage state = self.battery_service.state is_charging = state in ["CHARGING", "FULLY_CHARGED"] @@ -448,10 +451,10 @@ class BatteryIndicator(Box): tooltip = self.get_battery_tooltip(percentage, state) percentage_text = f"{percentage}%" - # Update icon, tooltip, and percentage label - self.battery_icon.set_from_file(get_relative_path(icon_file)) - self.battery_button.set_tooltip_text(tooltip) - self.battery_label.set_label(percentage_text) + # Update icon, tooltip, and percentage label + self.battery_icon.set_from_file(get_relative_path(icon_file)) + self.battery_button.set_tooltip_text(tooltip) + self.battery_label.set_label(percentage_text) def on_battery_clicked(self, *args): """Handle Battery indicator click"""