Sanitize hyprland language string only instead of the whole format. Fixes #1940
This commit is contained in:
parent
f4cfafd238
commit
3c8ca009ff
|
@ -55,6 +55,8 @@ void Language::onEvent(const std::string& ev) {
|
||||||
if (config_.isMember("keyboard-name") && kbName != config_["keyboard-name"].asString())
|
if (config_.isMember("keyboard-name") && kbName != config_["keyboard-name"].asString())
|
||||||
return; // ignore
|
return; // ignore
|
||||||
|
|
||||||
|
layoutName = waybar::util::sanitize_string(layoutName);
|
||||||
|
|
||||||
const auto briefName = getShortFrom(layoutName);
|
const auto briefName = getShortFrom(layoutName);
|
||||||
|
|
||||||
if (config_.isMember("format-" + briefName)) {
|
if (config_.isMember("format-" + briefName)) {
|
||||||
|
@ -64,8 +66,6 @@ void Language::onEvent(const std::string& ev) {
|
||||||
layoutName = fmt::format(fmt::runtime(format_), layoutName);
|
layoutName = fmt::format(fmt::runtime(format_), layoutName);
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutName = waybar::util::sanitize_string(layoutName);
|
|
||||||
|
|
||||||
if (layoutName == layoutName_) return;
|
if (layoutName == layoutName_) return;
|
||||||
|
|
||||||
layoutName_ = layoutName;
|
layoutName_ = layoutName;
|
||||||
|
@ -87,6 +87,8 @@ void Language::initLanguage() {
|
||||||
searcher = searcher.substr(searcher.find("keymap:") + 8);
|
searcher = searcher.substr(searcher.find("keymap:") + 8);
|
||||||
searcher = searcher.substr(0, searcher.find_first_of("\n\t"));
|
searcher = searcher.substr(0, searcher.find_first_of("\n\t"));
|
||||||
|
|
||||||
|
searcher = waybar::util::sanitize_string(searcher);
|
||||||
|
|
||||||
auto layoutName = std::string{};
|
auto layoutName = std::string{};
|
||||||
const auto briefName = getShortFrom(searcher);
|
const auto briefName = getShortFrom(searcher);
|
||||||
|
|
||||||
|
@ -97,8 +99,6 @@ void Language::initLanguage() {
|
||||||
layoutName = fmt::format(fmt::runtime(format_), searcher);
|
layoutName = fmt::format(fmt::runtime(format_), searcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutName = waybar::util::sanitize_string(layoutName);
|
|
||||||
|
|
||||||
layoutName_ = layoutName;
|
layoutName_ = layoutName;
|
||||||
|
|
||||||
spdlog::debug("hyprland language initLanguage found {}", layoutName_);
|
spdlog::debug("hyprland language initLanguage found {}", layoutName_);
|
||||||
|
|
Loading…
Reference in New Issue