From 170b138026bb0e234b71e9031f30be021ed73b85 Mon Sep 17 00:00:00 2001
From: Alessandro Astone <ales.astone@gmail.com>
Date: Sat, 15 Jun 2024 22:34:36 +0200
Subject: [PATCH] wayland: Allow configuring locale1 mode from kwinrc

KWin already supports following org.freedesktop.locale1 for the
keyboard keymap, but only by passing a command-line option. This is
typically used in SDDM when running the greeter in kwin_wayland.

We want to use locale1 mode in livesys environments too, so that
environment-agnostic installers can configure the keyboard and also
immediatly apply the same configuration to the running desktop.
When KWin is started through `startplasma` we cannot easily supply
an extra command-line option, so we need to make this configurable
from the external environment, in the form of a KConfig.

The command-line option will keep precedence over the KConfig.
---
 src/main_wayland.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp
index 8905ecceb78..98a58250ccf 100644
--- a/src/main_wayland.cpp
+++ b/src/main_wayland.cpp
@@ -472,6 +472,8 @@ int main(int argc, char *argv[])
 
     if (parser.isSet(locale1Option)) {
         a.setFollowLocale1(true);
+    } else {
+        a.setFollowLocale1(a.config()->group(QStringLiteral("Wayland")).readEntry("FollowLocale1", false));
     }
 
     bool ok = false;
-- 
GitLab

