mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Fix hyprland language initialization issues
This commit is contained in:
parent
c1ea7626b9
commit
531bdfb8bb
@ -79,16 +79,26 @@ void Language::onEvent(const std::string& ev) {
|
|||||||
void Language::initLanguage() {
|
void Language::initLanguage() {
|
||||||
const auto INPUTDEVICES = gIPC->getSocket1Reply("devices");
|
const auto INPUTDEVICES = gIPC->getSocket1Reply("devices");
|
||||||
|
|
||||||
if (!config_.isMember("keyboard-name")) return;
|
|
||||||
|
|
||||||
const auto KEEBNAME = config_["keyboard-name"].asString();
|
const auto KEEBNAME = config_["keyboard-name"].asString();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto searcher = INPUTDEVICES.substr(INPUTDEVICES.find(KEEBNAME) + KEEBNAME.length());
|
auto searcher = KEEBNAME.empty() ? INPUTDEVICES : INPUTDEVICES.substr(INPUTDEVICES.find(KEEBNAME) + KEEBNAME.length());
|
||||||
searcher = searcher.substr(searcher.find("keymap:") + 7);
|
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"));
|
||||||
|
|
||||||
layoutName_ = searcher;
|
auto layoutName = std::string{};
|
||||||
|
const auto BRIEFNAME = getShortFrom(searcher);
|
||||||
|
|
||||||
|
if (config_.isMember("format-" + BRIEFNAME)) {
|
||||||
|
const auto PROPNAME = "format-" + BRIEFNAME;
|
||||||
|
layoutName = fmt::format(format_, config_[PROPNAME].asString());
|
||||||
|
} else {
|
||||||
|
layoutName = fmt::format(format_, searcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutName = waybar::util::sanitize_string(layoutName);
|
||||||
|
|
||||||
|
layoutName_ = layoutName;
|
||||||
|
|
||||||
spdlog::debug("hyprland language initLanguage found {}", layoutName_);
|
spdlog::debug("hyprland language initLanguage found {}", layoutName_);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user