What is the best way to continuously monitor battery percentage?
I'm trying to write a program that shows the current battery charge level. The most obvious way to do this is to simply poll /sys/class/power_supply/BAT0/capacity at fixed intervals. But that quickly becomes an trade-off between high CPU usage (polling too frequently) and out-of-date information (po...