JakeStanger / ironbar

Customisable Wayland gtk bar written in Rust.
https://crates.io/crates/ironbar
MIT License
560 stars 47 forks source link

Hide the battry indicator when there is no battery. #698

Closed Kl4rry closed 1 month ago

Kl4rry commented 1 month ago

Is your feature request related to a problem? Please describe. I use the same ironbar config on my desktop and my laptop. On my laptop I want to use the battery indicator but it is not useful on a desktop as it has no battery.

Describe the solution you'd like Add an option to make the battery indicator disappear when there is no battery.

Describe alternatives you've considered I could have two different configs but that seems a bit annoying when they are 99% the same.

JakeStanger commented 1 month ago

You can use show_if for this, and only show the module if a battery is detected. Something like:

{ 
  type = "upower"
  show_if = "[ -f /sys/class/power_supply/BAT0/capacity ]"
}
Kl4rry commented 1 month ago

Thanks!