sway-language: ignore events with empty layout

This commit is contained in:
Maxim Baz 2021-06-05 14:50:25 +02:00
parent 5444a66e71
commit 999c1b6b81
No known key found for this signature in database
GPG Key ID: 011FDC52DA839335
1 changed files with 3 additions and 1 deletions

View File

@ -45,8 +45,10 @@ 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);
if (!layout_name.empty()) {
lang_ = Glib::Markup::escape_text(layout_name);
}
}
dp.emit();
} catch (const std::exception& e) {
spdlog::error("Language: {}", e.what());