Merge pull request #1485 from LukashonakV/master

Hide/Unhide temperature module when "format*" is empty.
This commit is contained in:
Alex 2022-03-19 10:24:59 +01:00 committed by GitHub
commit 8c6063d181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,14 @@ auto waybar::modules::Temperature::update() -> void {
} else { } else {
label_.get_style_context()->remove_class("critical"); label_.get_style_context()->remove_class("critical");
} }
if(format.empty()) {
event_box_.hide();
return;
} else {
event_box_.show();
}
auto max_temp = config_["critical-threshold"].isInt() ? config_["critical-threshold"].asInt() : 0; auto max_temp = config_["critical-threshold"].isInt() ? config_["critical-threshold"].asInt() : 0;
label_.set_markup(fmt::format(format, label_.set_markup(fmt::format(format,
fmt::arg("temperatureC", temperature_c), fmt::arg("temperatureC", temperature_c),