mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix(battery): adapter status
This commit is contained in:
parent
755fad6bc3
commit
de0ee9fcb2
@ -145,15 +145,15 @@ const std::string waybar::modules::Battery::getState(uint8_t capacity) const
|
||||
auto waybar::modules::Battery::update() -> void
|
||||
{
|
||||
auto [capacity, status] = getInfos();
|
||||
if (status == "Unknown") {
|
||||
status = getAdapterStatus(capacity);
|
||||
}
|
||||
label_.set_tooltip_text(status);
|
||||
std::transform(status.begin(), status.end(), status.begin(), ::tolower);
|
||||
auto format = format_;
|
||||
auto state = getState(capacity);
|
||||
label_.get_style_context()->remove_class(old_status_);
|
||||
label_.get_style_context()->add_class(status);
|
||||
if (status == "Unknown") {
|
||||
status = getAdapterStatus(capacity);
|
||||
}
|
||||
old_status_ = status;
|
||||
if (!state.empty() && config_["format-" + status + "-" + state].isString()) {
|
||||
format = config_["format-" + status + "-" + state].asString();
|
||||
|
Loading…
Reference in New Issue
Block a user