There's a battery crate, and looking the api it might be possible to simplify the battery block quite a bit.
Good find. Looks like it will introduce four new dependencies:
[dependencies]
cfg-if = "0.1"
num-traits = { version = "0.2", default_features = false }
uom = { version = "^0.23", features = ["autoconvert", "f32", "si"] }
[target.'cfg(target_os = "linux")'.dependencies]
lazycell = "1.2.1"
Might be worthwhile if it can solve issues such as #429?
It won't solve #429, but maybe in a few months hopefully.
Are there advantages other than simplicity? The current code seems to work pretty well.
Looking into this project a bit, this appears to solve #463 if this crate is used to fetch Bluetooth device battery. I do find this to be a step in the right direction regardless as this would open up more opportunities for cross-platform support as long as the status bar support i3-status format.
Cross-platform support in this case being FreeBSD support (#296), I imagine? It's possible we'll get there someday but for now there is a mountain of Linux-specific code in this project.
this appears to solve #463 if this crate is used to fetch Bluetooth device battery
I can't see support for Bluetooth (or UPower, for that matter) in the source of the crate, have I missed something?
Cross-platform support in this case being FreeBSD support (#296), I imagine? It's possible we'll get there someday but for now there is a mountain of Linux-specific code in this project.
I wasn't referring to any specific platform, this crate, in general, would reduce some of the Linux specific code that exists. After some further investigation, the current feature set seems to be a step backwards as it has less support.
I can't see support for Bluetooth (or UPower, for that matter) in the source of the crate, have I missed something?
There is reference to UPower here, I appear to have been mistaken on it helping with #463 as it doesn't seem to support Bluetooth, I incorrectly assumed it supported such devices.
The battery crate introduced some 0.5%~1% load on a similar project of mine, with an interval of 1 second. One should evaluate whether it can be used without this hit
Closing until a more compelling case is made.
Most helpful comment
The battery crate introduced some 0.5%~1% load on a similar project of mine, with an interval of 1 second. One should evaluate whether it can be used without this hit