Repository navigation
Keep the charging icon while the battery's charge rate is still stale - #19046
Conversation
[Low impact] No new code issue blocks merging; the previously requested running-bar check is still owed. Findings
SummaryThe power panel keeps the charging icon while battery-rate readings settle after plugging in.
Reviews (3) · Last reviewed commit: "Keep the charging icon while the battery..." · Reviewed by Greptile |
quattro's omacom#19046 gave the power panel's threshold, icon and mode helpers a rateFresh argument in the slot this branch used for kernelLevel. Both stay: rateFresh keeps quattro's position and kernelLevel follows it, so quattro's callers and tests are untouched and this branch's three latched-battery tests pass true for a fresh rate before the kernel level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the conflict in shell/plugins/panels/power/Model.js, where omacom#19046 added a rateFresh argument to batteryIcon beside this branch's new drawingFromBattery helper: both are kept. Panel.qml merged on its own, so omacom#19046's chargeRateFresh reset now follows the settled discharging state rather than UPower.onBattery alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omacom#19046 reset chargeRateFresh from onDischargingChanged, which on quattro followed UPower.onBattery. Here discharging also follows the settled battery state, so every Charging/Discharging flip on a weak charger restarted the 90 s window and kept a stalled-rate charge limit from being recognised for as long as the flips continued. Drive the reset from onOnBatteryChanged instead, so it still runs only when external power arrives or leaves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: muse-wonder via pi, thinking high <noreply@pi.dev>
quattro's omacom#19046 added a rateFresh guard just above the line this branch changes in chargeThresholdActive(), and its own assertions where this branch adds the slow-charge ones in power-test.sh. Model.js merged cleanly; the test conflict keeps both sets of assertions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| onDischargingChanged: { | ||
| chargeRateFresh = discharging | ||
| if (discharging) chargeRateSettle.stop() | ||
| else chargeRateSettle.restart() | ||
| } | ||
| Timer { | ||
| id: chargeRateSettle | ||
| interval: 90000 | ||
| onTriggered: root.chargeRateFresh = true |
There was a problem hiding this comment.
The repository requires visual changes to be checked in the running UI, but the PR explicitly says this panel was not tested through a real plug-in. The new tests pass rateFresh directly, so they do not check whether onDischargingChanged starts the timer or whether the icon stays correct through plug-in, timeout, and unplug. Check those transitions in the running branch and attach the required visual evidence before merging.
File Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
This merged on 2026-11-15 and went out in the v4-5-1 backport (#19202), so the running-bar check is still owed. @fidecastro, you're on edge with it. Could you plug in, wait out the 90 seconds, and unplug once, and post what the icon and panel show at each step?
…omacom#19046) (cherry picked from commit d7586fb)
Resolves the conflicts with omacom#19046 (stale charge rate) and omacom#20379 (charge limit state): the settled charge-limit verdict is now a trailing argument after rateFresh and limitState, and the detail refresh uses the queued battery read quattro added instead of a separate process wrapper. Review fixes: - Picking a power profile while an unplug is held back saved it as the AC preference. setProfile now reads the power source UPower reports, not the one the panel shows. - A widget created on AC treated its own creation as the plug-in, so a real charge limit read as charging for a minute. The battery service now records when power last arrived, and a widget settles from that; one created long after a plug-in shows the limit at once. - The 90 s charge-rate guard follows the reported power source, so a held dropout still restarts it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After plugging in a charger, the bar's battery icon shows the charging mark for an instant, goes back to the plain battery for up to a minute, then shows the charging mark again. The panel says "Threshold" and "Holding" for that minute, on a battery with no charge limit set.
Cause.
chargeThresholdActive()takes "charging at 0.2 W or less" for a charge limit holding the battery. Some batteries refresh their rate only every half minute, so right after external power arrives UPower reportschargingwith the rate from before, 0 W. Recorded once a second on a Surface Laptop 7 (qcom-battmgr), after plugging in at 16:33:42:The same gap showed on every plug-in I recorded, on both USB-C ports.
Change. The panel tracks whether the rate can be trusted:
chargeRateFreshgoes false when the laptop comes off battery and true again 90 seconds later, or at once when it goes back on battery. While it is false, the stalled-rate rule is skipped. The explicit signals still count straight away:PendingCharge, andFullyChargedbelow 99%. With a real limit holding at 80%, this battery reportspending-charge, so that case is unaffected.Model.jstakes the flag as an optional last argument, so its other callers and tests behave as before.90 seconds covers the 49 I measured with room for a slower battery. A laptop that reports
chargingat 0 W while a limit holds will show the charging mark for those 90 seconds after plugging in, then the plain battery as today.Tested.
test/shell.d/power-test.shwith five new cases (stale rate is not a threshold; fresh stalled rate still is;PendingChargecounts while stale; icon and label while stale), andpower-no-battery-test.sh, which loads the panel. Not tested: the changed panel on a running bar through a real plug-in. The battery here is being held at its 80% limit, which is the case the change leaves alone.Prepared with Claude Fable 5.2.