Merge pull request #1125 from maximbaz/sway-language-ignore-empty

This commit is contained in:
Alex 2021-06-05 18:01:26 +02:00 committed by GitHub
commit 6e041d5275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -45,7 +45,9 @@ void Language::onEvent(const struct Ipc::ipc_response& res) {
auto payload = parser_.parse(res.payload)["input"];
if (payload["type"].asString() == "keyboard") {
auto layout_name = payload["xkb_active_layout_name"].asString().substr(0,2);
lang_ = Glib::Markup::escape_text(layout_name);
if (!layout_name.empty()) {
lang_ = Glib::Markup::escape_text(layout_name);
}
}
dp.emit();
} catch (const std::exception& e) {