diff --git a/include/AIconLabel.hpp b/include/AIconLabel.hpp index 91b022a4..34beb9b2 100644 --- a/include/AIconLabel.hpp +++ b/include/AIconLabel.hpp @@ -21,7 +21,7 @@ class AIconLabel : public ALabel { Gtk::Box box_; unsigned app_icon_size_{24}; - bool labelContainsIcon; + bool label_contains_icon; bool iconEnabled() const; }; diff --git a/src/AIconLabel.cpp b/src/AIconLabel.cpp index 81953d7b..c053aa97 100644 --- a/src/AIconLabel.cpp +++ b/src/AIconLabel.cpp @@ -62,31 +62,31 @@ AIconLabel::AIconLabel(const Json::Value &config, const std::string &name, const } std::tuple AIconLabel::extractIcon(const std::string& input) { - std::string iconResult = ""; - std::string labelResult = input; + std::string icon_result = ""; + std::string label_result = input; try { - const std::regex iconSearch(R"((?=\\0icon\\1f).+?(?=\\n))"); - std::smatch iconMatch; - if (std::regex_search(input, iconMatch, iconSearch)) { - iconResult = iconMatch[0].str().substr(9); + const std::regex icon_search(R"((?=\\0icon\\1f).+?(?=\\n))"); + std::smatch icon_match; + if (std::regex_search(input, icon_match, icon_search)) { + icon_result = icon_match[0].str().substr(9); - const std::regex cleanLabelPattern(R"(\\0icon\\1f.+?\\n)"); - labelResult = std::regex_replace(input, cleanLabelPattern, ""); + const std::regex clean_label_pattern(R"(\\0icon\\1f.+?\\n)"); + label_result = std::regex_replace(input, clean_label_pattern, ""); } } catch (const std::exception& e) { spdlog::warn("Error while parsing icon from label. {}", e.what()); } - return std::make_tuple(iconResult, labelResult); + return std::make_tuple(icon_result, label_result); } auto AIconLabel::update() -> void { - labelContainsIcon = false; + label_contains_icon = false; auto [iconLabel, cleanLabel] = extractIcon(label_.get_label().c_str()); - labelContainsIcon = iconLabel.length() > 0; + label_contains_icon = iconLabel.length() > 0; - if (labelContainsIcon) { + if (label_contains_icon) { label_.set_markup(cleanLabel); if (iconLabel.front() == '/') { @@ -108,7 +108,7 @@ auto AIconLabel::update() -> void { } bool AIconLabel::iconEnabled() const { - return labelContainsIcon || (config_["icon"].isBool() ? config_["icon"].asBool() : false); + return label_contains_icon || (config_["icon"].isBool() ? config_["icon"].asBool() : false); } } // namespace waybar