eww icon indicating copy to clipboard operation
eww copied to clipboard

add `EWW_BATTERY` support in (free|open|net)bsd

Open dangerdyke opened this issue 3 years ago • 2 comments

Description

This should add battery info support for 3/4 of the *BSDs supported as rust compile targets. I have only tested on FreeBSD, but based on the man pages of the others it should work there as well.

Usage

unchanged

Showcase

$ target/release/eww get EWW_BATTERY
{"BAT0": { "status": "high", "capacity": 61 }, "total_avg": 61}
$ uname -o
FreeBSD

Additional Notes

I was not able to add support for dragonflyBSD, as it's version of the apm command is aliased to acpiconf -i 0, which has different output and only lists the first battery. The htop source code seems to implement this for dragonfly using something to the effect of sysctl -n hw.acpi.battery.life, but I could not find documentation for that sysctl variable anywhere, and don't have a dragonfly install to test on.

Checklist

Please make sure you can check all the boxes that apply to this PR.

  • [x] I added my changes to CHANGELOG.md, if appropriate.
  • [X] I used cargo fmt to automatically format all code before committing

dangerdyke avatar Dec 13 '22 23:12 dangerdyke

Could you rebase this onto latest master? I would do it, and according to github I should be able to, but it seems as though currently I can't push to your branch ^^' Looking good though, thanks!

elkowar avatar Feb 25 '23 09:02 elkowar

done!

dangerdyke avatar Mar 02 '23 00:03 dangerdyke