Skip to content

feat(battery): add a discharging class while on battery power - #1208

Open
JanDeDobbeleer wants to merge 1 commit into
amnweb:mainfrom
JanDeDobbeleer:feat/battery-discharging-class
Open

JanDeDobbeleer wants to merge 1 commit into
amnweb:mainfrom
JanDeDobbeleer:feat/battery-discharging-class

Conversation

@JanDeDobbeleer

@JanDeDobbeleer JanDeDobbeleer commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The battery status classes only tell charging apart from the charge level (status-critical … status-full, status-charging). A battery that is plugged in but not charging, because it is full or held at a charge limit, gets exactly the same classes as one that is draining. So there is no way to style the widget differently while the device runs on battery power, for example a red icon.

Fix

While the device is not plugged in, the icon and label also get a discharging class next to their status-* class. It is removed again as soon as power is connected. The docs list the new selectors:

.battery-widget .widget-container .label.discharging {}
.battery-widget .widget-container .icon.discharging {}

Testing

  • ruff check / ruff format clean, full test suite passes.
  • Running in a local build on a Surface Pro 11 (ARM64); validated both cases.

The status classes only distinguish charging from the charge level, so a
battery that is plugged in but not charging (full, or held by a charge limit)
gets the same classes as one that is draining. The icon and label now also get
a discharging class while the device runs on battery power, so it can be
styled separately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant