💅 style(launcher, notification_popup): update keyboard focus styling and add discharging battery icons

This commit is contained in:
sankalp committed 2025-06-21 14:51:00 +05:45
1 parent 131670ea02
commit 5f55fb2c61
12 files changed
+531 -91

No files matched your search

+4 -5
View File
@@ -394,14 +394,13 @@ class Applications(Box):
for child in children:
self.add(child)
# Only show children if there are any applications
# Note: Component-level visibility is handled by the parent DockComponents class
# Show/hide the entire component based on whether there are applications
if len(children) > 0:
self.show_all()
else:
# Hide the widget content but don't override component-level visibility
for child in self.get_children():
child.hide()
# Hide the entire component when there are no applications
# This allows the dock to properly detect when it's empty and auto-hide
self.hide()
return True
+35 -16
View File
@@ -217,10 +217,16 @@ class Battery(Box):
else:
self.level.set_visible(False)
# Remove any existing profile classes
# Remove any existing profile and discharging classes
self.circle.remove_style_class("power-saver")
self.circle.remove_style_class("performance")
self.circle.remove_style_class("balanced")
self.circle.remove_style_class("discharging")
self.circle.remove_style_class("discharging-low")
self.circle.remove_style_class("discharging-critical")
self.icon.remove_style_class("discharging")
self.icon.remove_style_class("discharging-low")
self.icon.remove_style_class("discharging-critical")
# Apply power profile styling and icons
if power_profile:
@@ -230,9 +236,35 @@ class Battery(Box):
elif power_profile == "performance":
self.icon.set_markup(icons.power_performance)
else: # balanced
self.icon.set_markup(icons.battery)
# In balanced mode, show discharging icons when discharging
if state == "DISCHARGING":
# Show different discharging icons and apply styling based on battery level
if percentage <= 15:
self.icon.set_markup(icons.bat_low)
self.circle.add_style_class("discharging-critical")
self.icon.add_style_class("discharging-critical")
elif percentage <= 30:
self.icon.set_markup(icons.alert)
self.circle.add_style_class("discharging-low")
self.icon.add_style_class("discharging-low")
else:
self.icon.set_markup(icons.bat_discharging)
self.circle.add_style_class("discharging")
self.icon.add_style_class("discharging")
elif state == "CHARGING":
self.icon.set_markup(icons.charging)
else:
self.icon.set_markup(icons.battery)
else:
self.icon.set_markup(icons.battery)
# No power profile - show basic battery state icons
if state == "FULLY_CHARGED":
self.icon.set_markup(icons.battery)
elif state == "CHARGING":
self.icon.set_markup(icons.charging)
elif state == "DISCHARGING":
self.icon.set_markup(icons.discharging)
else:
self.icon.set_markup(icons.battery)
# Apply alert styling if battery is low AND not charging
if percentage <= 15 and not charging:
@@ -242,18 +274,5 @@ class Battery(Box):
self.icon.remove_style_class("alert")
self.circle.remove_style_class("alert")
# Update icon based on battery state if not in power profile mode
if not power_profile:
if state == "FULLY_CHARGED":
self.icon.set_markup(icons.battery)
elif state == "CHARGING":
self.icon.set_markup(icons.charging)
elif percentage <= 15 and state == "DISCHARGING":
self.icon.set_markup(icons.alert)
elif state == "DISCHARGING":
self.icon.set_markup(icons.discharging)
else:
self.icon.set_markup(icons.battery)
self.set_visible(True)
return True