Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the battery status script to avoid reporting “holding” when UPower’s state is stale by trusting sysfs for charge state and tightening the “holding” detection logic.
Changes:
- Prefer sysfs
statusover UPowerstatewhen available. - Require an idle (near-zero) charge rate before reporting “holding”.
- Add regression tests covering stale UPower
pending-chargevs live sysfs charging.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/shell.d/battery-status-test.sh | Adds test cases to ensure stale UPower state doesn’t override live sysfs state and rate. |
| bin/omarchy-battery-status | Uses sysfs status to override UPower state and refines holding detection to require idle rate. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+50
to
+51
| stale_dir=$(mktemp -d) | ||
| trap 'rm -rf "$tmp_dir" "$stale_dir"' EXIT |
|
Was thIs closed because it will be fixed by another PR? |
Author
|
Not sure, sorry. I just needed to close this because I could no longer follow through on this work. |
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.
omarchy-battery-statusreports "Holding" while the battery is actively charging on a ThinkPad with a charge threshold set.UPower's
statelags the kernel by tens of seconds, the same way itsenergy-ratedoes. The script already works around that lag for the rate, readingpower_nowfrom sysfs, but still takesstatefrom UPower. On a T480 charging at 29W:The
pending-chargebranch has no rate guard, so the panel showsBattery 75% · Holding at 75-80% · 28.7W / 87Whmid-charge — holding and 28.7W at the same time.Two changes:
$battery_path/statusover UPower'sstatewhen it is readable.charge_holdingbranch. Holding means no power is moving, so a stale label must not claim it while watts are flowing. Thechargingbranch's now-redundantcharge_idlecheck folds into that precondition.Covered by two cases in
battery-status-test.sh: sysfs reporting charging against a stalepending-chargelabel, and the same fixture at 0W confirming genuine holding still reports.