From 37307931972a4e1fbe6fb4b44018c54264c4643c Mon Sep 17 00:00:00 2001 From: Sasha Moak Date: Sat, 26 Nov 2022 10:02:16 -0800 Subject: [PATCH] feat: add icon support to the wireplumber module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds basic icon support for the wireplumber module. This can be achieved by using `{icon}` in the `format` config and pairing it with the `format-icons` config as well. Example: ``` "wireplumber": { "format": "{volume}% {icon}", "format-icons": ["", "", ""] } ``` --- src/modules/wireplumber.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp index 0ab129e66..6ebf748 100644 --- a/src/modules/wireplumber.cpp +++ b/src/modules/wireplumber.cpp @@ -156,8 +156,8 @@ auto waybar::modules::Wireplumber::update() -> void { label_.get_style_context()->remove_class("muted"); } - std::string markup = - fmt::format(format, fmt::arg("node_name", node_name_), fmt::arg("volume", volume_)); + std::string markup = fmt::format(format, fmt::arg("node_name", node_name_), + fmt::arg("volume", volume_), fmt::arg("icon", getIcon(volume_))); label_.set_markup(markup); getState(volume_); @@ -169,7 +169,8 @@ auto waybar::modules::Wireplumber::update() -> void { if (!tooltip_format.empty()) { label_.set_tooltip_text(fmt::format(tooltip_format, fmt::arg("node_name", node_name_), - fmt::arg("volume", volume_))); + fmt::arg("volume", volume_), + fmt::arg("icon", getIcon(volume_)))); } else { label_.set_tooltip_text(node_name_); }