From 8c9dd94670172c9386570e3ef52c95df8789b954 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 17 Apr 2019 10:46:08 +0200 Subject: [PATCH] feat(mpd): Add support for setting tooltip label when disconnected --- src/modules/mpd.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/mpd.cpp b/src/modules/mpd.cpp index 85020807..d1208762 100644 --- a/src/modules/mpd.cpp +++ b/src/modules/mpd.cpp @@ -59,6 +59,14 @@ void waybar::modules::MPD::setLabel() { auto format = config_["format-disconnected"].isString() ? config_["format-disconnected"].asString() : "disconnected"; label_.set_markup(format); + + if (tooltipEnabled()) { + std::string tooltip_format; + tooltip_format = config_["tooltip-format-disconnected"].isString() ? + config_["tooltip-format-disconnected"].asString() : "MPD (disconnected)"; + // Nothing to format + label_.set_tooltip_text(tooltip_format); + } return; } else { label_.get_style_context()->remove_class("disconnected"); @@ -92,7 +100,7 @@ void waybar::modules::MPD::setLabel() { if (tooltipEnabled()) { std::string tooltip_format; tooltip_format = config_["tooltip-format"].isString() ? - config_["tooltip-format"].asString() : "MPD"; + config_["tooltip-format"].asString() : "MPD (connected)"; auto tooltip_text = fmt::format(tooltip_format, fmt::arg("artist", artist), fmt::arg("album-artist", album_artist),