tobi-wan-kenobi / bumblebee-status

bumblebee-status is a modular, theme-able status line generator for the i3 window manager.
https://bumblebee-status.readthedocs.io/en/main/
MIT License
1.2k stars 229 forks source link

Correct battery modules handling of critical/warning states #927

Closed kellya closed 1 year ago

kellya commented 1 year ago

The logic for the critical/warning handling on the battery modules was applied BEFORE the discharging- logic. This made it possible for those discharging states to get applied over a critical/warning and allow a theme to override the critical/warning colors with a state of "discharging-10", for example.

This change moves that logic after the discharging state, so that it will always "win" if critical or warning states are set.

This also adds the "discharging" battery state to the critical/warning check so the state will apply if the battery is not on AC power, but would return normal otherwise. Meaning, if the battery is "critical" from a percentage check, but is plugged into power, the critical state is removed.

tobi-wan-kenobi commented 1 year ago

Ah, that makes a lot of sense, many thanks!

Note to self: Tests for that particular case would be nice!