Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.32k stars 689 forks source link

Battery Module shows "format" instead of "format-plugged" when plugged in and battery is full #3202

Open ghost opened 4 months ago

ghost commented 4 months ago

When the battery is at 100% and plugged, the module shows whatever is defined in "format" rather than "format-plugged".

This seems like an edge case bug, since I believe the "plugged" status should have precedence over the default one, even at full charge.

Here's my battery module configuration, in case it's helpful.

  "battery": {
    "states": {
      "warning": 30,
      "critical": 15
    },
    "format": "{capacity}% {icon}",
    "format-icons": ["", "", "", "", ""],
    "format-plugged": "{capacity}% ",
    "format-charging": "{capacity}% "
  },
Nishantdd commented 4 months ago

Use "format-full" i guess

ghost commented 4 months ago

Use "format-full" i guess

What would that solve exactly? I assume what you are suggesting is adding something like

"format-full": "{capacity}% "

But in the case the battery is at 100% but not plugged in that would still be wrong. I tought about it too before posting this issue but came to this conclusion.

The only solution is to have "format-plugged" always override "format" if "format-full" is not set. Or make a "format-full-plugged" option, but that seems overkill.

Nishantdd commented 3 months ago

I see, well in my case format-plugged doesn't work at all to begin with so can't help with that. Have you checked if the status is "Discharging" or "Not Charging" after reaching 100%. Well if it's "Not Charging", then it's probably a bug... I don't know what's wrong in my case though, the cat /sys/class/power_supply/BAT0/status does show "Not Charging" but battery module just doesn't update

checkinindza commented 2 weeks ago

It seems that cat /sys/class/power_supply/BAT0/status only reports it as Full when battery is fully charged, but still plugged in, so Waybar has no way how to tell the difference between full and full, but still plugged in.

I also like to know if there's a way to tell Waybar that the battery is full, but still plugged in.