Repository navigation
Conversation
omarchy-battery-status always took the first BAT* device, so a dual-battery ThinkPad with a present-but-dead internal pack reported 0% / 0W / Holding. UPower's DisplayDevice is not a substitute: it still counts the dead cell's energy-full, so the bar showed ~49% with a 10-hour ETA while the live pack was at 99%. Aggregate only packs that still show voltage, energy, or current. A healthy empty cell keeps voltage, so a real 0% pack is not dropped. The power panel uses the same live set for the icon and fill instead of DisplayDevice.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
isLivePack only looked at energy, rate, and percentage, so a 0% cell with voltage was dropped while omarchy-battery-status kept it. Use the same voltage floor as the CLI, and emit pack.N.path so the panel can follow the CLI-selected set when Quickshell's UPowerDevice has no voltage.
UPower's percentage and time-to-full still count a dead pack's energy-full, so a T460 with a 0 V internal cell showed ~50% and a 10 hour ETA while the working slice was nearly full. Always derive % and remaining time from the live energy and instantaneous watts, prefer kernel charge limits, and stop falling the bar fill back to DisplayDevice. Signed sysfs power_now is taken as magnitude so charging time is not blank. A 0-100 kernel window is treated as no charge limit.
omarchy-battery-status emits BAT1; Quickshell may expose the sysfs path. Basename match keeps CLI-selected packs when voltage is missing.
DisplayDevice and the EC fuel gauge can cliff (40% → 6% in a minute) while live watt-hours are still ~40%. Warn at 10% and suspend-then-hibernate at 2% only from that live remainder; ignore UPower Auto so it cannot race.
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #7917. Draft until that lands — rebase onto
quattroafter merge. Unique work is the commit afterMatch CLI pack ids to UPower nativePath suffixes.Fixes the other half of the dual-battery ThinkPad failure: the bar can show a live pack at ~40% while UPower Auto still
suspend-then-hibernates becauseDisplayDevice/ the EC fuel gauge cliffed to ~3%.On a T460 with a present-but-dead internal pack, BAT1 dropped 40% → 6% in 60 seconds at ~8 W (physically ~1%).
upowerdthen requested suspend-then-hibernate. The machine never resumed (e1000e Failed to disable ULP); a tap on the power button does nothing in that S3.#7917 already skips dead packs for the widget and
omarchy-battery-status. This PR points the warning and the 2% action at the same live watt-hour remainder, and stops UPower from racing it.Behavior
omarchy.batteryno longer readsUPower.displayDevice.omarchy-battery-criticalrunssystemctl suspend-then-hibernate(falls back tosuspend). Hibernate is still optional; the contract is “do not act before live 2%”.CriticalPowerAction=Ignore(andAllowRiskyCriticalPowerAction=true) so UPower Auto cannot suspend on the EC percentage. The shell owns the 2% path after login.Tests
test/shell.d/battery-test.sh— live 10% warn, live 2% act, dead-pack skip, 8.4→1.3 Wh / 60 s / 8 W cliff, Service.qml wiring.test/shell.d/power-test.sh— same cliff reject onapplyEnergySample.bash test/shell.d/battery-test.shandbash test/shell.d/power-test.share green.Verified on a ThinkPad T460 (dead BAT0, live BAT1): the local clone of this path is what now owns warn/act; UPower reports
critical-action: Ignore.