battery
battery copied to clipboard
cross-platform, normalized battery information library
This PR (based on #26) adds some additional testing based on mocks. I think it's quite difficult to test without mocking the filesystem, and thus an example test was added....
Check #16 for the details. Opened a new PR because the previous one was a PR from the master branch instead of the feature branch.
I use this in my lock screen script to generate the battery status on my laptop. The original text was TMI (for a lock screen) and required a fair bit...
We could argue this fix should be added to @DHowett 's go-plist utility, but I felt more comfortable adding the change here for the time being as I needed a...
Recent MacOS versions have a feature called "optimized battery charging" which holds the battery charge at ~80% until the OS anticipates a full charge is necessary (or the user requests...
Issue #4 Add a `Summarize() (*Battery, error)` func to aggregate data from multiple batteries. @KenjiTakahashi not sure tho about some metrics, like `State`. I followed the simplest logic - higher...
I feel like many apps will only want to display a single battery indicator -- it's unlikely the user cares whether their laptop hardware has a single battery controller, or...
When I run the `battery.GetAll()` function, it gives me the following error: ``` panic: [{ChargeRate:read /sys/class/power_supply/BAT1/power_now: no such device}] ``` While I was tinkering, I found out that the `ls`...
Proposing to use `strings.Builder` in place of `string concatenation`, in `battery.Error()` - following are the results - ``` ╭─[email protected] ~/workspace/battery ‹master› ╰─➤ go test -bench=. -benchtime 2s -count 1 -benchmem...