Skip to content

Show design capacity and battery health in the power panel - #10377

Closed
iamteedoh wants to merge 11 commits into
omacom:quattrofrom
iamteedoh:battery-health-in-power-panel
Closed

iamteedoh wants to merge 11 commits into
omacom:quattrofrom
iamteedoh:battery-health-in-power-panel

Conversation

@iamteedoh

@iamteedoh iamteedoh commented Sep 5, 2026 •

Copy link
Copy Markdown

What changes

The power panel shows one capacity row, labelled "Battery size", filled with UPower's energy-full. That is what the pack charges to today, not what it was sold as. On a worn battery the two are far apart and nothing on the panel explains the gap: my old pack read 64Wh in the panel against 90Wh on its label.

omarchy-battery-status --shell gains two keys, both already in the upower -i output it parses:

design  90Wh    # energy-full-design
health  72%     # capacity, i.e. energy-full / energy-full-design, rounded

The stats grid gains two rows. Nothing that is there today moves:

  • "Battery size" now shows the nameplate figure (it showed energy-full)
  • "Current capacity", new, under "Charge cycles": what the pack charges to now
  • "Battery health", new, under the charge rate: the percentage
  • "Condition", new, on a last row: a one-word verdict on the left and what to do about it on the right, under the health figure
Battery health Condition Advice
90% and up Great Practically new
80% to 89% Normal Normal for its age
70% to 79% Worn Plan a replacement
Under 70% Bad Time to replace it

80% is the line most vendors treat as a pack still being serviceable, and where capacity warranties tend to stop. 70% is more of a judgement call: a third of the pack is gone by then. The wording and the thresholds live in one small function, and the Condition row is its own commit, so it is easy to adjust or drop without touching the rest.

The manual's top bar chapter gains a short "Battery health" section with the same table.

When the firmware reports no design figure (or no health figure), the script prints neither key and the panel renders exactly as it does today.

This is a much smaller version of what this PR first proposed. The separate Battery Health section, the bar and the scroll wrapper are gone, so the change is now about 100 added lines across 7 files, with 11 English strings.

Notes:

Verification

  • test/shell.d/battery-status-test.sh covers both new keys, the rounding, the capacity-level trap, and a pack with no design figure printing neither key. The new assertions fail against quattro's script. power-test.sh covers the verdict at each threshold and that the advice is translated by tier.
  • battery-status-test.sh, power-test.sh, i18n-test.sh and qml-text-format-test.sh pass. I did not run the full ./test/all for this revision.
  • Checked in a running session on a ThinkPad P52 with a new pack (92Wh of 92Wh, 100%, 8 cycles).
  • The Normal, Worn and Bad rows were checked on screen by making the status script report 85%, 72% and 55% on the same machine, so those three captures are simulated readings, not worn packs.
  • Not rechecked on screen: the no-design fallback (covered by the script test only), and a translation long enough to be cut off in the advice cell.

Screenshots

Earlier comments below show previous layouts. These captures show the current one.

BEFORE (Stock)

power-panel-before

AFTER (with the new changes)

power-panel-condition

THE FOUR CONDITIONS (Great and Worn on top, Normal and Bad below; all but Great are simulated readings)

power-panel-condition-tiers

@iamteedoh

iamteedoh commented Sep 6, 2026 •

Copy link
Copy Markdown
Author

I spent additional time getting a toggle to control battery charge level (from 80% to 100%) and hold:

image

If there is interest in pushing this upstream for a PR review, I can do that as well but I won't do it with this PR since the battery charge level toggle was a bit more involved. I opened #10431 for it, and there is a longer standing request at #627 that has been open for over a year.

@iamteedoh

Copy link
Copy Markdown
Author

Heads up from the review on #10384: the design and health lines here read $battery_info, which that PR splits into aggregate_info and primary_info. The hunk applies cleanly and then reads an unset variable, so both keys would silently vanish and the health section would never render.

If #10384 lands first I'll rebase and point those two lines at primary_info, since DisplayDevice carries neither energy-full-design nor capacity. Happy to go in either order.

@iamteedoh

iamteedoh commented Sep 8, 2026 •

Copy link
Copy Markdown
Author

I replaced the battery in this machine, so here is the panel across the health range. Same laptop, same code, only the pack changed.

pr-side-by-side

Left is the pack this PR was written against: LGC 01AV495, 284 cycles, 64.3Wh of a 90.06Wh design. Right is a new SANYO 01AV496, 1 cycle, 92.4Wh of 92.4Wh.

Worth noting because it is the first time the top tier has been exercised on real hardware. Every check I had run on the 90% and above path until now was a unit test with a synthetic value, so a genuinely new pack reporting energy_full equal to energy_full_design is the first end to end confirmation that side reads correctly.

The panel's one capacity row is labelled "Battery size" and filled with
UPower's energy-full, which is what the pack charges to today rather than
what it was sold as. A worn battery therefore reads far below the number
on its label with nothing on the panel to explain the gap, and the figure
a user would act on - how much capacity is left to lose - is absent.

omarchy-battery-status --shell now also emits energy-full-design as
`design` and UPower's own capacity as `health`. "Battery size" carries the
nameplate figure, "Current capacity" is added beside it, and a BATTERY
HEALTH section carries the percentage, a bar, the cycle count and a
verdict: Great, Normal, Worn or Bad. 80% divides Normal from Worn, being
the line most vendors treat as still serviceable and where capacity
warranties usually stop; 70% divides Worn from Bad, a third of the pack
gone and the band where fade tends to accelerate.

A pack whose firmware omits the design figure yields neither key, and both
are gated on the pair, so the panel falls back to exactly what it renders
today instead of showing a fabricated 100%.
@iamteedoh
iamteedoh force-pushed the battery-health-in-power-panel branch from 23468d2 to d061fe3 Compare September 18, 2026 03:39
@iamteedoh

Copy link
Copy Markdown
Author

I saw the overlap being mapped out over on #10392 and wanted to mention where this one fits, since it isn't on that list.

This PR doesn't touch how the battery gets picked or how the rate is calculated. It just adds two values to omarchy-battery-status --shell (energy-full-design as design and UPower's capacity as health) and shows them in the panel: the original capacity as "Battery size", a "Current capacity" row next to it, and a Battery Health section with the percentage, a bar, the cycle count and a verdict. None of the other PRs cover design capacity or health, so this shouldn't get in the way of however the aggregation work gets split up.

One thing I checked in case #10392 goes in first: on machines with more than one battery it points battery_info at DisplayDevice, and DisplayDevice doesn't report energy-full-design or capacity. Since the health section needs both before it shows, it would just hide itself on those machines instead of showing a fake 100%. Single battery machines aren't affected. So I don't think it needs a rebase, but I'm happy to do one if it does.

It's still mergeable against quattro, and the screenshots above show it on my P52 with the old worn battery (64.3Wh of 90.06Wh) and the new one (92.4Wh of 92.4Wh).

I also noticed #8579 adds battery health to the power panel too and touches three of the same files, along with a charge limit. If you'd rather go with one of them, I'm fine either way and can rebase on top of whichever one lands.

@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
@RAJAT2005DEBNATH

Copy link
Copy Markdown

I really want your approach to work. I myself am trying to find a way to limit my charging. Could you please give me some update about your current progress ?

If this gets integrated with omarchy or exists as a plugin that would be great.

@iamteedoh

Copy link
Copy Markdown
Author

I really want your approach to work. I myself am trying to find a way to limit my charging. Could you please give me some update about your current progress ?

If this gets integrated with omarchy or exists as a plugin that would be great.

Hey thanks for the interest! The battery-health PR is awaiting review and needs updating against current upstream; the charge-cap integration is implemented locally, but hasn’t been submitted as a PR or packaged publicly. I'm working on resolving the conflicts in the meantime.

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Adds design capacity, battery health, and condition advice to the power panel.

  • The Power panel compares a battery’s original and current capacity and shows its health.

Reviews (8) · Last reviewed commit: "battery-health-in-power-panel: Set the a..." · Reviewed by Greptile

Comment thread shell/plugins/panels/power/Panel.qml Resolved
Panel.qml keeps the scrollable column from this branch and takes
quattro's Style.duration timing for the charging pulse.

The battery status test keeps the design capacity and health checks
beside quattro's status-line, full-battery and sparse-reading cases.
The power test keeps the Model.js health checks and the VM-run profile
scroll check, and drops the Panel.qml source-text asserts in line with
omacom#16334, as does the battery status test's rg check.
@iamteedoh

Copy link
Copy Markdown
Author

Merged the latest quattro in and fixed the conflicts. The panel works the same, it just picks up the new Style.duration timings. I also dropped the Panel.qml source-text asserts from the tests to match #16334. The Model.js and battery status tests are still there, and the shell suite passes.

Comment thread shell/plugins/panels/power/Panel.qml Resolved
@iamteedoh

iamteedoh commented Nov 16, 2026 •

Copy link
Copy Markdown
Author

I reworked this into a much smaller change, so the earlier screenshots in this thread no longer show what the PR does. The description has the current before and after.

The separate Battery Health section, the bar and the scroll wrapper are gone. The panel now keeps every stock row where it is and adds two rows below:

  • "Battery size" shows the nameplate figure when the battery reports one
  • "Current capacity" is new, under "Charge cycles"
  • "Battery health" is new, under the charge rate
  • "Condition" is new, on a last row: a one-word verdict, with what to do about it beside it

When the firmware reports no design figure, the panel renders exactly as it does today.

The diff is about 100 added lines across 7 files, and it is merged up to current quattro. It does not touch charge limits, so it should not get in the way of #13205 or #19061.

Before:

power-panel-before

After:

power-panel-after

Both are from my ThinkPad P52 with a new pack, so size and capacity match and health reads 100%.

@iamteedoh

Copy link
Copy Markdown
Author

Closing as superseded by #20379, which added battery health to the power panel.

@iamteedoh iamteedoh closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants