diff --git a/src/Compositor.cpp b/src/Compositor.cpp index de2a44f5..2784c173 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -580,6 +580,7 @@ void CCompositor::startCompositor() { } setenv("WAYLAND_DISPLAY", m_szWLDisplaySocket.c_str(), 1); + setenv("XDG_SESSION_TYPE", "wayland", 1); signal(SIGPIPE, SIG_IGN); diff --git a/src/devices/IKeyboard.cpp b/src/devices/IKeyboard.cpp index eb475b73..4c8f5880 100644 --- a/src/devices/IKeyboard.cpp +++ b/src/devices/IKeyboard.cpp @@ -155,6 +155,8 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) { if (xkbState) xkb_state_unref(xkbState); + xkbState = nullptr; + if (keymap) { Debug::log(LOG, "Updating keyboard {:x}'s translation state from a provided keymap", (uintptr_t)this); xkbState = xkb_state_new(keymap); diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index e395aea9..b7ffa943 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1291,7 +1291,7 @@ void CInputManager::onKeyboardMod(SP pKeyboard) { const auto LAYOUT = pKeyboard->getActiveLayout(); - pKeyboard->updateXKBTranslationState(); + pKeyboard->updateXKBTranslationState(pKeyboard->xkbKeymap); g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->hlName + "," + LAYOUT}); EMIT_HOOK_EVENT("activeLayout", (std::vector{pKeyboard, LAYOUT}));