[GH-ISSUE #1296] Battery: Power draw in watts #7415

Open
opened 2026-05-23 02:54:19 +01:00 by JakeStanger · 2 comments
Owner

Originally created by @imnotpoz on GitHub (Dec 22, 2025).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1296

Is your feature request related to a problem? Please describe.

I'd like to see the power draw in watts when I'm on battery

Describe the solution you'd like

Implement power draw in watts in the battery module

Describe alternatives you've considered

Using wa*bar (it has that feature)

Additional context

https://github.com/Alexays/Waybar/wiki/Module:-Battery
https://github.com/Alexays/Waybar/blob/master/src/modules/battery.cpp (sorry for making you read c++ code)

Originally created by @imnotpoz on GitHub (Dec 22, 2025). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1296 **Is your feature request related to a problem? Please describe.** I'd like to see the power draw in watts when I'm on battery **Describe the solution you'd like** Implement power draw in watts in the battery module **Describe alternatives you've considered** Using wa*bar (it has that feature) **Additional context** https://github.com/Alexays/Waybar/wiki/Module:-Battery https://github.com/Alexays/Waybar/blob/master/src/modules/battery.cpp (sorry for making you read c++ code)
Author
Owner

@JakeStanger commented on GitHub (Dec 22, 2025):

Crate hasn't been updated in 5 years so I don't want to depend on it, but I think this has support for reading power draw and it's Rust so it's probably easier to port:

https://github.com/svartalf/rust-battery

<!-- gh-comment-id:3683065508 --> @JakeStanger commented on GitHub (Dec 22, 2025): Crate hasn't been updated in 5 years so I don't want to depend on it, but I think this has support for reading power draw and it's Rust so it's probably easier to port: https://github.com/svartalf/rust-battery
Author
Owner

@bill88t commented on GitHub (Dec 31, 2025):

It's particularly simple diy'ing it. Under /sys/class/power_supply, the batteries with current monitoring support, expose the attribute current_now.

This value may be negative with some drivers, cough cough sbs_battery on ARM systems, but it usually is positive, even for energy loss. The logic cannot be just a blind // 1000 mA. It has to be evaluated over the presence of attribute online of detected power inputs (also under the same sysfs folder), falling back to simple percentage direction monitoring (50% -> 52%, means were charging).
Still, hardly a matter worthy of dependency churn.

I'd do it myself, but I just installed this bloody thing, not even having launched it. It'll have to wait till next year.

Still if you wish to do this, the only last bit of knowledge needed to 100% this is that some HID devices may also show up as batteries and charging sources, which you'll need to exclude from these scans. Carpet-blocking r"*hid*" works.
There isn't much to anything else in this needed to implement this.

<!-- gh-comment-id:3702674653 --> @bill88t commented on GitHub (Dec 31, 2025): It's particularly simple diy'ing it. Under `/sys/class/power_supply`, the batteries with current monitoring support, expose the attribute `current_now`. This value may be negative with some drivers, *cough cough* sbs_battery on ARM systems, but it usually is positive, even for energy loss. The logic cannot be just a blind `// 1000` mA. It has to be evaluated over the presence of attribute `online` of detected power inputs (also under the same sysfs folder), falling back to simple percentage direction monitoring (50% -> 52%, means were charging). Still, hardly a matter worthy of dependency churn. I'd do it myself, but I just installed this bloody thing, not even having launched it. It'll have to wait till next year. Still if you wish to do this, the only last bit of knowledge needed to 100% this is that some HID devices may also show up as batteries and charging sources, which you'll need to exclude from these scans. Carpet-blocking `r"*hid*"` works. There isn't much to anything else in this needed to implement this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#7415
No description provided.