yambar-modules-battery(5)

πŸ’– battery β€” the module that reads ur battery status πŸ’…

okay so this is yambar-modules-battery(5), bestie β€” a whole manpage in the File Formats Manual section, and it's literally the one that tells u what ur battery is doing. let's get into it 🫢


✨ NAME ✨

battery β€” this module reads battery status. that's it. that's the vibe check. πŸ”‹


🌸 DESCRIPTION 🌸

so this module reads battery status from /sys/class/power_supply and uses udev to monitor for changes. icon behaviour, no cap. ✨

now, real talk: it is common (and like, "normal") for batteries to be in the state unknown under certain conditions. don't panic, it's not u, it's them. 😭

for example, some have been seen to enter the unknown state when charging and the capacity reaches ~90%. the battery then stays in unknown, rather than charging, until it has been fully charged and enters the state full. like it just refuses to participate?? πŸ’€

this does not happen with all batteries, and other batteries may enter the state unknown under other conditions. so basically, batteries are unhinged and we love them anyway. πŸŽ€


πŸ¦‹ TAGS πŸ¦‹

here's everything the module exposes as tags, bestie β€” every single one, i would never gatekeep:

  • name β€” string β€” the battery device name πŸ‘‘
  • manufacturer β€” string β€” name of the battery manufacturer 🏭
  • model β€” string β€” the battery model name 🏷️
  • state β€” string β€” one of full, not charging, charging, discharging or unknown πŸ”„
  • capacity β€” range β€” capacity left, in percent πŸ”‹
  • estimate β€” string β€” estimated time left (to empty while discharging, or to full while charging), formatted as HH:MM. ⏰

πŸŽ€ CONFIGURATION πŸŽ€

these are the knobs u can turn. "Req" = is it required? yes or no, no mystery:

  • name β€” string β€” required: yes β€” battery device name (one of the names in /sys/class/power_supply) πŸ“
  • poll-interval β€” int β€” required: no β€” how often, in milliseconds, to poll for capacity changes (default=60000). Set it to 0 to disable polling.
⚠️ warning bestie: many batteries do not support asynchronous reporting. so like, turning polling off might leave u in the dark fr fr.

Also it cannot be less than 250ms β€” that's the floor, periodt. 🚫

  • battery-scale β€” int β€” required: no β€” how much to scale down the battery charge amount. some batteries report too high, resulting in bad discharge estimates. Default=1. πŸ“‰
  • smoothing-secs β€” int β€” required: no β€” how many seconds to perform smoothing over for battery discharge estimates. Default=100s. 🧚

🌈 EXAMPLES 🌈

here's one that ate, honestly:

bar:
  left:
    - battery:
        name: BAT0
        poll-interval: 30000
        content:
          string: {text: "BAT: {capacity}% {estimate}"}

look at that. BAT0, polling every 30000 ms, and a string particle showing BAT: {capacity}% {estimate}. iconic. ✨


πŸ’œ SEE ALSO πŸ’œ

go read these next, i'm obsessed with cross-references:


🫢 this has been the yambar-modules-battery(5) page from the File Formats Manual, dated 2024-04-22. go forth and monitor ur battery, bestie β€” slay πŸ’…πŸ’–
πŸ“¦ where this page comes from