diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-22 11:45:19 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-22 11:45:19 -0500 |
| commit | 7ababb9e652a7e6b04974ec5f833145f2c838299 (patch) | |
| tree | c52a77a48cbefb456e2a61ed1d8d786ff691f018 /tests/test-custom-ordering-arrayify.el | |
| parent | 5a07a56b99781f567929c46720dea0e90b23ebfb (diff) | |
| download | dotemacs-7ababb9e652a7e6b04974ec5f833145f2c838299.tar.gz dotemacs-7ababb9e652a7e6b04974ec5f833145f2c838299.zip | |
fix(host-environment): detect battery correctly on Linux desktops
`env-laptop-p` treated any `battery-format "%B"` value that wasn't literally "N/A" as "has a battery." On a Linux desktop using `battery-upower`, the result is "unknown". The AC adapter and USB-C power entries exist in /sys but there's no BAT*. That made desktops look like laptops. The per-machine font height switch in `font-config.el` broke as a result.
The fix uses /sys/class/power_supply/BAT* as the canonical Linux signal. That's what the kernel exposes, and what upower itself reads. Other platforms keep the `battery-format` path, but the fallback now checks for a live battery status char ("!", "+", "-") instead of only excluding "N/A".
Two pure helpers (`env--battery-status-char-indicates-battery-p`, `env--power-supply-has-battery-p`) keep the logic testable. The new test file covers Normal, Boundary, and Error cases for each helper.
Diffstat (limited to 'tests/test-custom-ordering-arrayify.el')
0 files changed, 0 insertions, 0 deletions
