i3pyblocks icon indicating copy to clipboard operation
i3pyblocks copied to clipboard

Create BatteryBlock using FileWatcherBlock

Open thiagokokada opened this issue 3 years ago • 0 comments

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).

thiagokokada avatar Sep 16 '20 11:09 thiagokokada