i3pyblocks
i3pyblocks copied to clipboard
Create BatteryBlock using FileWatcherBlock
There is already a SensorsBatteryBlock
, but it is based on PollingBlock
. Instead, let's reimplement it using sysfs
interface (https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power) and FileWatcherBlock
(based on aionotify
).
Some posts in StackOverflow on how to calculate the remaining time: https://stackoverflow.com/questions/26888636/how-to-calculate-the-time-remaining-until-the-end-of-the-battery-charge https://stackoverflow.com/questions/35516424/calculate-time-left-until-battery-is-discharged
(They're probably not precise, but I don't think the current battery calculations from psutil
are different from this).