Emit error when workspace mapping has invalid format

Closes #2024
This commit is contained in:
patrick96 2022-02-21 19:57:25 +01:00 committed by Patrick Ziegler
parent ae7686d24b
commit 59a581a39e
3 changed files with 15 additions and 0 deletions

View File

@ -134,11 +134,16 @@ namespace modules {
m_icons = std::make_shared<iconset>();
m_icons->add(DEFAULT_ICON, std::make_shared<label>(m_conf.get(name(), DEFAULT_ICON, ""s)));
int i = 0;
for (const auto& workspace : m_conf.get_list<string>(name(), "ws-icon", {})) {
auto vec = string_util::tokenize(workspace, ';');
if (vec.size() == 2) {
m_icons->add(vec[0], std::make_shared<label>(vec[1]));
} else {
m_log.err("%s: Ignoring ws-icon-%d because it has %s semicolons", name(), i, vec.size() > 2? "too many" : "too few");
}
i++;
}
}

View File

@ -61,11 +61,16 @@ namespace modules {
m_icons = std::make_shared<iconset>();
m_icons->add(DEFAULT_WS_ICON, std::make_shared<label>(m_conf.get(name(), DEFAULT_WS_ICON, ""s)));
int i = 0;
for (const auto& workspace : m_conf.get_list<string>(name(), "ws-icon", {})) {
auto vec = string_util::tokenize(workspace, ';');
if (vec.size() == 2) {
m_icons->add(vec[0], std::make_shared<label>(vec[1]));
} else {
m_log.err("%s: Ignoring ws-icon-%d because it has %s semicolons", name(), i, vec.size() > 2? "too many" : "too few");
}
i++;
}
try {

View File

@ -73,11 +73,16 @@ namespace modules {
m_icons = std::make_shared<iconset>();
m_icons->add(DEFAULT_ICON, std::make_shared<label>(m_conf.get(name(), DEFAULT_ICON, ""s)));
int i = 0;
for (const auto& workspace : m_conf.get_list<string>(name(), "icon", {})) {
auto vec = string_util::tokenize(workspace, ';');
if (vec.size() == 2) {
m_icons->add(vec[0], std::make_shared<label>(vec[1]));
} else {
m_log.err("%s: Ignoring icon-%d because it has %s semicolons", name(), i, vec.size() > 2? "too many" : "too few");
}
i++;
}
// Get list of monitors