mirror of
https://github.com/JakeStanger/ironbar.git
synced 2026-07-11 06:15:21 +01:00
[GH-ISSUE #1296] Battery: Power draw in watts #4608
Labels
No labels
A:Build
A:CI
A:Client
A:Config
A:Core
A:Documentation
A:Documentation
A:IPC
A:Testing
A:UX/UI
blocked
BREAKING CHANGE
duplicate
good first issue
GTK4
help wanted
invalid
M:Battery
M:Battery
M:Bindmode
M:Bluetooth
M:Brightness
M:Cairo
M:Clipboard
M:Clock
M:Clock
M:Custom
M:Focused
M:Keyboard
M:Launcher
M:Menu
M:Music
M:Music
M:Music
M:Network Manager
M:Notifications
M:SysInfo
M:Tray
M:Volume
M:Workspaces
partially resolved
P:Critical
P:High
P:Low
P:Medium
pull-request
T:Bug
T:Bug
T:Core Enhancement
T:Module Enhancement
T:New Module
T:Question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
JakeStanger/ironbar#4608
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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)
@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
@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 attributecurrent_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
// 1000mA. It has to be evaluated over the presence of attributeonlineof 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.