fix(power): #60 name-agnostic system-battery scan
All checks were successful
Check / eval (push) Successful in 2m53s

Replace BAT* globs with type=Battery + !scope=Device (same filter as
nomarchy-battery-notify) in charge-limit oneshot, menu gates, Waybar
power-profile self-gate, doctor, and install chassis detection. CMB0-
style names get charge-cap and laptop modules consistently.

V3 pending: confirm on non-BAT* hardware (HARDWARE-QUEUE). Close #60.

Verified: V1 (option-docs, hardware-db-modules, battery-charge-limit VM).
This commit is contained in:
Bernardo Magri
2026-07-10 08:32:24 +01:00
parent 09388196a9
commit c962d07841
9 changed files with 80 additions and 29 deletions

View File

@@ -232,8 +232,11 @@ else
fi
# ── laptop battery charge threshold (only when a limit is set) ───────
# Name-agnostic (BAT0, CMB0, …) — same type/scope filter as notify (#60).
bat_seen=0; bat_limited=0
for bat in /sys/class/power_supply/BAT*; do
for bat in /sys/class/power_supply/*/; do
[ "$(cat "$bat/type" 2>/dev/null)" = Battery ] || continue
[ "$(cat "$bat/scope" 2>/dev/null || echo System)" = Device ] && continue
f="$bat/charge_control_end_threshold"
[ -r "$f" ] || continue
bat_seen=1