Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

built-in battery module is not realtime

Open auroraanna opened this issue 1 year ago • 6 comments

The built-in battery module can take 20s or so take update it's state to react to a charger being plugged in or out. This dissonance between what the computer is telling me and what is actually the case is confusing and annoying.

auroraanna avatar Sep 14 '24 11:09 auroraanna

have you tried changing the interval to say 1?

"interval": 1,

this will refresh it every secs. put to 5 or 10 depending on your wish

sample: "battery": { "bat": "BAT2", "interval": 1, "states": { "warning": 30, "critical": 15 }, "format": "{capacity}% {icon}", "format-icons": ["", "", "", "", ""], "max-length": 25 }

JaKooLit avatar Sep 14 '24 14:09 JaKooLit

This is not a good solution as it uses more cpu time and is still not instant. The battery module should get notified of changed state immediately and not have to check for current state periodically.

auroraanna avatar Sep 14 '24 14:09 auroraanna

You can use "upower" module, for me its almost instantaneous.

varqox avatar Sep 15 '24 10:09 varqox

thanks, it's very fast in updating and shows the correct combined battery percentage too, unlike the battery module.

auroraanna avatar Oct 12 '24 18:10 auroraanna

Now i have to hope that upower has a better code in place. At least it says in its readme that it listens to device events, which i am guessing includes the batteries.

auroraanna avatar Oct 12 '24 18:10 auroraanna

Actually no, I am opening this again because I think that either upower should be the default battery module or that the default battery module should not periodically check for status but instead use some sort of listener/hook to get informed that state changed. Using filesystem listeners on /sys/class/power_supply/BAT*/ comes to mind but there is probably a better way.

auroraanna avatar Oct 12 '24 18:10 auroraanna

hmm, since the main issue with this is, that it doesn't update instantly when unplugging/plugging power, not that it doesn't update in realtime when charging/discharging, it seems fine to me to close this after #3474

auroraanna avatar Jan 28 '25 20:01 auroraanna