Merge pull request #1941 from eneshecan/master

Fixes https://github.com/Alexays/Waybar/issues/1940
This commit is contained in:
Alex 2023-01-23 10:24:44 +01:00 committed by GitHub
commit fea7ec9133
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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_);