Merge pull request #2170 from FintasticMan/hide_mpris_if_empty

mpris: Hide label if empty
pull/2171/head
Alex 2023-05-13 18:26:12 +02:00 committed by GitHub
commit 5b29119dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -630,7 +630,12 @@ auto Mpris::update() -> void {
fmt::arg("player_icon", getIconFromJson(config_["player-icons"], info.name)),
fmt::arg("status_icon", getIconFromJson(config_["status-icons"], info.status_string)));
label_.set_markup(label_format);
if (label_format.empty()) {
label_.hide();
} else {
label_.set_markup(label_format);
label_.show();
}
} catch (fmt::format_error const& e) {
spdlog::warn("mpris: format error: {}", e.what());
}