diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 41bfe06c..84909a8e 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -87,7 +87,7 @@ std::string devicesRequest() { result += "\n\nKeyboards:\n"; for (auto& k : g_pInputManager->m_lKeyboards) { - result += getFormat("\tKeyboard at %x:\n\t\t%s\n", &k, k.keyboard->name); + 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()); } result += "\n\nTablets:\n"; diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp index b6c38416..06f58f0a 100644 --- a/src/helpers/WLClasses.hpp +++ b/src/helpers/WLClasses.hpp @@ -69,6 +69,14 @@ struct SRenderData { bool blur = false; }; +struct SStringRuleNames { + std::string layout = ""; + std::string model = ""; + std::string variant = ""; + std::string options = ""; + std::string rules = ""; +}; + struct SKeyboard { wlr_input_device* keyboard; @@ -80,7 +88,7 @@ struct SKeyboard { std::string name = ""; - xkb_rule_names currentRules = {0}; + SStringRuleNames currentRules; int repeatRate = 0; int repeatDelay = 0; int numlockOn = -1; diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index bdcddbe1..883b5b5e 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -424,7 +424,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) { const auto OPTIONS = HASCONFIG ? g_pConfigManager->getDeviceString(pKeyboard->name, "kb_options") : g_pConfigManager->getString("input:kb_options"); try { - if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" && RULES == std::string(pKeyboard->currentRules.rules) && MODEL == std::string(pKeyboard->currentRules.model) && LAYOUT == std::string(pKeyboard->currentRules.layout) && VARIANT == std::string(pKeyboard->currentRules.variant) && OPTIONS == std::string(pKeyboard->currentRules.options)) { + if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" && RULES == pKeyboard->currentRules.rules && MODEL == pKeyboard->currentRules.model && LAYOUT == pKeyboard->currentRules.layout && VARIANT == pKeyboard->currentRules.variant && OPTIONS == pKeyboard->currentRules.options) { Debug::log(LOG, "Not applying config to keyboard, it did not change."); return; } @@ -446,7 +446,11 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) { .variant = VARIANT.c_str(), .options = OPTIONS.c_str()}; - pKeyboard->currentRules = rules; + pKeyboard->currentRules.rules = RULES; + pKeyboard->currentRules.model = MODEL; + pKeyboard->currentRules.variant = VARIANT; + pKeyboard->currentRules.options = OPTIONS; + pKeyboard->currentRules.layout = LAYOUT; const auto CONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS); @@ -463,7 +467,11 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) { Debug::log(ERR, "Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant, rules.rules, rules.model, rules.options); memset(&rules, 0, sizeof(rules)); - pKeyboard->currentRules = rules; + pKeyboard->currentRules.rules = ""; + pKeyboard->currentRules.model = ""; + pKeyboard->currentRules.variant = ""; + pKeyboard->currentRules.options = ""; + pKeyboard->currentRules.layout = ""; KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); }