Sanitize hyprland language string only instead of the whole format. Fixes #1940

This commit is contained in:
Enes Hecan 2023-01-13 16:28:34 +01:00
parent f4cfafd238
commit 3c8ca009ff

View File

@ -55,6 +55,8 @@ void Language::onEvent(const std::string& ev) {
if (config_.isMember("keyboard-name") && kbName != config_["keyboard-name"].asString())
return; // ignore
layoutName = waybar::util::sanitize_string(layoutName);
const auto briefName = getShortFrom(layoutName);
if (config_.isMember("format-" + briefName)) {
@ -64,8 +66,6 @@ void Language::onEvent(const std::string& ev) {
layoutName = fmt::format(fmt::runtime(format_), layoutName);
}
layoutName = waybar::util::sanitize_string(layoutName);
if (layoutName == layoutName_) return;
layoutName_ = layoutName;
@ -87,6 +87,8 @@ void Language::initLanguage() {
searcher = searcher.substr(searcher.find("keymap:") + 8);
searcher = searcher.substr(0, searcher.find_first_of("\n\t"));
searcher = waybar::util::sanitize_string(searcher);
auto layoutName = std::string{};
const auto briefName = getShortFrom(searcher);
@ -97,8 +99,6 @@ void Language::initLanguage() {
layoutName = fmt::format(fmt::runtime(format_), searcher);
}
layoutName = waybar::util::sanitize_string(layoutName);
layoutName_ = layoutName;
spdlog::debug("hyprland language initLanguage found {}", layoutName_);