From de0ee9fcb2d28149463d43370b3ef72c2ca3be1f Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 24 Dec 2018 12:17:07 +0100 Subject: [PATCH] fix(battery): adapter status --- src/modules/battery.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index a6938457..1d6c42a0 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -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();