Skip to content

Commit

Permalink
refactor(battery): update status class based on threshold for icons
Browse files Browse the repository at this point in the history
  • Loading branch information
amnweb committed Oct 29, 2024
1 parent 5351ac0 commit 6695b01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/widgets/yasb/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def _update_label(self):
# Ensure the icon is correctly set
icon = re.sub(r'<span.*?>|</span>', '', battery_status).strip()
active_widgets[widget_index].setText(icon)
icon = re.sub(r'<span.*?>|</span>', '', battery_status).strip()
active_widgets[widget_index].setText(icon)
existing_classes = active_widgets[widget_index].property("class")
new_classes = re.sub(r'status-\w+', '', existing_classes).strip()
active_widgets[widget_index].setProperty("class", f"{new_classes} status-{threshold}")
else:
alt_class = "alt" if self._show_alt_label else ""
formatted_text = battery_status.format(battery_status)
Expand Down

0 comments on commit 6695b01

Please sign in to comment.