mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Merge pull request #965 from ofwinterpassed/master
Fixing logic in getIcon
This commit is contained in:
commit
1f620828c2
@ -60,14 +60,14 @@ std::string ALabel::getIcon(uint16_t percentage, const std::string& alt, uint16_
|
|||||||
std::string ALabel::getIcon(uint16_t percentage, std::vector<std::string>& alts, uint16_t max) {
|
std::string ALabel::getIcon(uint16_t percentage, std::vector<std::string>& alts, uint16_t max) {
|
||||||
auto format_icons = config_["format-icons"];
|
auto format_icons = config_["format-icons"];
|
||||||
if (format_icons.isObject()) {
|
if (format_icons.isObject()) {
|
||||||
|
std::string _alt = "default";
|
||||||
for (const auto& alt : alts) {
|
for (const auto& alt : alts) {
|
||||||
if (!alt.empty() && (format_icons[alt].isString() || format_icons[alt].isArray())) {
|
if (!alt.empty() && (format_icons[alt].isString() || format_icons[alt].isArray())) {
|
||||||
format_icons = format_icons[alt];
|
_alt = alt;
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
format_icons = format_icons["default"];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
format_icons = format_icons[_alt];
|
||||||
}
|
}
|
||||||
if (format_icons.isArray()) {
|
if (format_icons.isArray()) {
|
||||||
auto size = format_icons.size();
|
auto size = format_icons.size();
|
||||||
|
Loading…
Reference in New Issue
Block a user