If last battery is not present, no info is retrieved at all
Tux opened this issue · 3 comments
if /pro/acpy/info has BAT0 and BAT1 and both have info and state and the last has content
present: no
Which would result in an error like
Use of uninitialized value $battery{"charging_state"} in string ne at …/bin/rainbarf line 387.
It overrules earlier batteries found. The loop should probably be changed to
if (grep { -d $_ and -e ($acpi_info ||= qq($_/info)) and -e ($acpi_state ||= qq($_/state)) } sort glob q(/proc/acpi/battery/BAT[0-9]) ) { for my $file ($acpi_info, $acpi_state) {
I changed =
to ||=
.
Thanks for spotting this! I've updated the code & refactored the whole battery info retrieval, could you please check if it is working fine for your setup?
god, I hate Module::Build :(
I'd expect rainbarf --help
to return the synopsis, not the whole manual page. That'd better be rainbarf --man
, rainbarf --info
or whatever
$ rainbarf --battery --bolt --remaining --bright --loadavg --swap
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂⚡▇
colored in my xterm. So yes, it works
Eh, indeed, that documentation was designed to look good as markdown, on GitHub. Perhaps I'll just print synopsis+URL and mention the fact that perldoc rainbarf
is what one wants when no GUI/Internet is reachable :)