Refer to my answer on a similar question: https://stackoverflow.com/a/79558341/14164142
TLDR; Electron PowerMonitor API does not work everywhere (as of right now, April 2025), so I built a different way to do it, which you can use in the interim.