From 39bf4035052902cbcb247639748b09b4726d4048 Mon Sep 17 00:00:00 2001 From: Robinhuett <5955614+Robinhuett@users.noreply.github.com> Date: Mon, 25 Feb 2019 22:04:09 +0100 Subject: [PATCH] feat(custom): Add field for additional data to json --- include/modules/custom.hpp | 1 + src/modules/custom.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/modules/custom.hpp b/include/modules/custom.hpp index f9e4dec6..9057c4a4 100644 --- a/include/modules/custom.hpp +++ b/include/modules/custom.hpp @@ -22,6 +22,7 @@ class Custom : public ALabel { const std::string name_; std::string text_; + std::string alt_; std::string tooltip_; std::string class_; std::string prevclass_; diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index 18491afa..eeff881a 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -91,6 +91,7 @@ auto waybar::modules::Custom::update() -> void } auto str = fmt::format(format_, text_, + fmt::arg("alt", alt_), fmt::arg("icon", getIcon(percentage_)), fmt::arg("percentage", percentage_)); label_.set_markup(str); @@ -144,6 +145,7 @@ void waybar::modules::Custom::parseOutputJson() while (getline(output, line)) { auto parsed = parser_.parse(line); text_ = Glib::Markup::escape_text(parsed["text"].asString()); + alt_ = Glib::Markup::escape_text(parsed["alt"].asString()); tooltip_ = parsed["tooltip"].asString(); class_ = parsed["class"].asString(); if (!parsed["percentage"].asString().empty() && parsed["percentage"].isUInt()) {