diff --git a/src/modules/wayland/waylandmodule.cpp b/src/modules/wayland/waylandmodule.cpp index d8c7bef15..421159f22 100644 --- a/src/modules/wayland/waylandmodule.cpp +++ b/src/modules/wayland/waylandmodule.cpp @@ -716,20 +716,30 @@ void WaylandModule::selfDiagnose() { } } - std::unordered_set groupLayouts; - for (const auto &groupName : instance_->inputMethodManager().groups()) { - if (const auto *group = - instance_->inputMethodManager().group(groupName)) { - groupLayouts.insert(group->defaultLayout()); - } - if (groupLayouts.size() >= 2) { - messages.push_back( - _("Sending keyboard layout configuration to wayland " - "compositor from Fcitx is " - "not yet supported on current desktop. You may still use " - "Fcitx's internal layout conversion by adding layout as " - "input method to the input method group.")); - break; + // layout diagnosis only when overriding is enabled + if (*config_.allowOverrideXKB) { + std::optional firstLayout; + for (const auto &groupName : + instance_->inputMethodManager().groups()) { + if (const auto *group = + instance_->inputMethodManager().group(groupName)) { + const auto &layout = group->defaultLayout(); + if (!firstLayout) { + firstLayout = layout; + } else if (layout != *firstLayout) { + messages.push_back(_( + "Sending keyboard layout configuration to wayland " + "compositor from Fcitx is " + "not yet supported on current desktop. You may " + "still " + "use " + "Fcitx's internal layout conversion by adding " + "layout " + "as " + "input method to the input method group.")); + break; + } + } } }