added active keymap prop

This commit is contained in:
vaxerski 2022-07-13 16:02:14 +02:00
parent e93b45615c
commit ef7ee2fd0f

View file

@ -295,6 +295,7 @@ R"#( {
result += "\"keyboards\": [\n"; result += "\"keyboards\": [\n";
for (auto& k : g_pInputManager->m_lKeyboards) { for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = xkb_keymap_layout_get_name(wlr_keyboard_from_input_device(k.keyboard)->keymap, 0);
result += getFormat( result += getFormat(
R"#( { R"#( {
"address": "0x%x", "address": "0x%x",
@ -303,7 +304,8 @@ R"#( {
"model": "%s", "model": "%s",
"layout": "%s", "layout": "%s",
"variant": "%s", "variant": "%s",
"options": "%s" "options": "%s",
"active_keymap": "%s"
},)#", },)#",
&k, &k,
k.keyboard->name, k.keyboard->name,
@ -311,7 +313,8 @@ R"#( {
k.currentRules.model.c_str(), k.currentRules.model.c_str(),
k.currentRules.layout.c_str(), k.currentRules.layout.c_str(),
k.currentRules.variant.c_str(), k.currentRules.variant.c_str(),
k.currentRules.options.c_str() k.currentRules.options.c_str(),
KM
); );
} }
@ -377,7 +380,8 @@ R"#( {
result += "\n\nKeyboards:\n"; result += "\n\nKeyboards:\n";
for (auto& k : g_pInputManager->m_lKeyboards) { for (auto& k : g_pInputManager->m_lKeyboards) {
result += getFormat("\tKeyboard at %x:\n\t\t%s\n\t\t\trules: r \"%s\", m \"%s\", l \"%s\", v \"%s\", o \"%s\"\n", &k, k.keyboard->name, k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(), k.currentRules.variant.c_str(), k.currentRules.options.c_str()); const auto KM = xkb_keymap_layout_get_name(wlr_keyboard_from_input_device(k.keyboard)->keymap, 0);
result += getFormat("\tKeyboard at %x:\n\t\t%s\n\t\t\trules: r \"%s\", m \"%s\", l \"%s\", v \"%s\", o \"%s\"\n\t\t\tactive keymap: %s\n", &k, k.keyboard->name, k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(), k.currentRules.variant.c_str(), k.currentRules.options.c_str(), KM);
} }
result += "\n\nTablets:\n"; result += "\n\nTablets:\n";