diff --git a/assets/ascii/funtoo.txt b/assets/ascii/funtoo.txt index 42518eb..80f82d8 100644 --- a/assets/ascii/funtoo.txt +++ b/assets/ascii/funtoo.txt @@ -1,10 +1,10 @@ -${c1} .dKXXd . - :XXl;:. .OXo -.'OXO'' .''''''''''''''''''''':XNd..'oco.lco, -xXXXXXX, cXXXNNNXXXXNNXXXXXXXXNNNNKOOK; d0O .k - kXX xXo KNNN0 KNN. 'xXNo :c; 'cc. - kXX xNo KNNN0 KNN. :xxxx. 'NNo - kXX xNo loooc KNN. oNNNN. 'NNo - kXX xN0:. KNN' oNNNX' ,XNk - kXX xNNXNNNNNNNNXNNNNNNNNXNNOxXNX0Xl - ... ......................... .;cc;. +${magenta} .dKXXd . +${magenta} :XXl;:. .OXo +${magenta}.'OXO'' .''''''''''''''''''''':XNd..'oco.lco, +${magenta}xXXXXXX, cXXXNNNXXXXNNXXXXXXXXNNNNKOOK; d0O .k +${magenta} kXX xXo KNNN0 KNN. 'xXNo :c; 'cc. +${magenta} kXX xNo KNNN0 KNN. :xxxx. 'NNo +${magenta} kXX xNo loooc KNN. oNNNN. 'NNo +${magenta} kXX xN0:. KNN' oNNNX' ,XNk +${magenta} kXX xNNXNNNNNNNNXNNNNNNNNXNNOxXNX0Xl +${magenta} ... ......................... .;cc;. diff --git a/src/display.cpp b/src/display.cpp index 5e251e0..063a3d7 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -101,7 +101,7 @@ std::vector Display::render(const Config& config, const colors_t& c if (config.gui) { // check parse.cpp - size_t pos = asciiArt_s.rfind("$ <"); + const size_t pos = asciiArt_s.rfind("$ auto_colors; if (!config.sep_reset.empty() && parsingLayout) { if (config.sep_reset_after) { - replace_str(output, config.sep_reset, config.sep_reset + "${0}"); + replace_str(output, config.sep_reset, config.sep_reset + "${0}"); replace_str(pureOutput, config.sep_reset, config.sep_reset + "${0}"); } else { - replace_str(output, config.sep_reset, "${0}" + config.sep_reset); + replace_str(output, config.sep_reset, "${0}" + config.sep_reset); replace_str(pureOutput, config.sep_reset, "${0}" + config.sep_reset); } } + // escape pango markup + // https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gmarkup.c#L2150 + // workaround: just put "\<" or "\&" in the config, e.g "$ \<- Kernel" + if (config.gui) + { + replace_str(output, "\\<", "<"); + replace_str(output, "\\&", "&"); + } + else + { + replace_str(output, "\\<", "<"); + replace_str(output, "\\&", "&"); + } + + replace_str(pureOutput, "\\<", "<"); + replace_str(pureOutput, "\\&", "&"); + while (true) { oldDollarSignIndex = dollarSignIndex; @@ -356,8 +372,7 @@ std::string parse(const std::string_view input, systemInfo_t& systemInfo, std::s if (hasStart(command, "auto")) { - std::uint16_t ver = - static_cast(command.length() > 4 ? std::stoi(command.substr(4)) - 1 : 0); + std::uint16_t ver = static_cast(command.length() > 4 ? std::stoi(command.substr(4)) - 1 : 0); if (ver >= auto_colors.size() || ver < 1) ver = 0; @@ -442,9 +457,9 @@ std::string parse(const std::string_view input, systemInfo_t& systemInfo, std::s const std::string_view color = clrs.at(0); const std::string_view weight = clrs.at(1); const std::string_view type = clrs.at(2); - output.replace(dollarSignIndex, output.length() - dollarSignIndex, - fmt::format("{}", - type, color, weight, output.substr(endBracketIndex + 1))); + output.replace( dollarSignIndex, output.length() - dollarSignIndex, + fmt::format("{}", + type, color, weight, output.substr(endBracketIndex + 1))); } else @@ -524,27 +539,6 @@ std::string parse(const std::string_view input, systemInfo_t& systemInfo, std::s } } - // https://github.com/dunst-project/dunst/issues/900 - // pango markup doesn't like '<' if it's not a tag - // and doesn't like '&' too - // workaround: just put "\<" or "\&" in the config, e.g "$ \<- Kernel" - if (config.gui) - { - replace_str(output, "\\<", "<"); - replace_str(output, "\\&", "&"); - replace_str(output, "&lt;", "<"); - replace_str(output, "<span", "\\", "\\"); - } - else - { - replace_str(output, "\\<", "<"); - replace_str(output, "\\&", "&"); - } - - replace_str(pureOutput, "\\<", "<"); - replace_str(pureOutput, "\\&", "&"); - return output; } @@ -584,6 +578,7 @@ static std::string get_auto_gtk_format(const std::string_view gtk2, const std::s else return fmt::format("{} [GTK2], {} [GTK3], {} [GTK4]", gtk2, gtk3, gtk4); } + else if (gtk3 != MAGIC_LINE && gtk4 != MAGIC_LINE) { if (gtk3 == gtk4) @@ -591,6 +586,7 @@ static std::string get_auto_gtk_format(const std::string_view gtk2, const std::s else return fmt::format("{} [GTK3], {} [GTK4]", gtk3, gtk4); } + else if (gtk2 != MAGIC_LINE && gtk3 != MAGIC_LINE) { if (gtk2 == gtk3) @@ -654,7 +650,7 @@ void addValueFromModule(systemInfo_t& sysInfo, const std::string& moduleName, co const Config& config, const colors_t& colors, bool parsingLayout) { #define SYSINFO_INSERT(x) sysInfo[moduleName].insert({ moduleMemberName, variant(x) }) - // yikes, here we go. + const auto& moduleMember_hash = fnv1a16::hash(moduleMemberName); static std::vector queried_gpus; static std::vector queried_disks;