From 5414e5124516d008e54e077ffc28915b6935038a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 7 Sep 2024 09:25:45 -0400 Subject: [PATCH] [keyboard] Add kwin-specific configuration flag Running `kwin_wayland --locale1` makes KWin listen to locale1 for keyboard updates, but not everybody has that. Introduce a KWin-specific configuration flag that will (re)write the KWin configuration. --- src/modules/keyboard/Config.cpp | 5 +++++ src/modules/keyboard/Config.h | 1 + src/modules/keyboard/keyboard.conf | 12 ++++++++++++ src/modules/keyboard/keyboard.schema.yaml | 5 +++++ 4 files changed, 23 insertions(+) diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp index 291cddb5e..2f4f53323 100644 --- a/src/modules/keyboard/Config.cpp +++ b/src/modules/keyboard/Config.cpp @@ -714,6 +714,11 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) m_convertedKeymapPath = getString( configurationMap, "convertedKeymapPath" ); m_configureEtcDefaultKeyboard = getBool( configurationMap, "writeEtcDefaultKeyboard", true ); m_configureLocale1 = getBool( configurationMap, "useLocale1", !isX11 ); + + bool bogus = false; + const auto configureItems = getSubMap( configurationMap, "configure", bogus ); + m_configureKWin = getBool( configureItems, "kwin", false ); + m_guessLayout = getBool( configurationMap, "guessLayout", true ); } diff --git a/src/modules/keyboard/Config.h b/src/modules/keyboard/Config.h index 2d28990f1..1549e5d83 100644 --- a/src/modules/keyboard/Config.h +++ b/src/modules/keyboard/Config.h @@ -121,6 +121,7 @@ private: bool m_configureXkb = true; bool m_configureEtcDefaultKeyboard = true; bool m_configureLocale1 = false; + bool m_configureKWin = false; bool m_guessLayout = false; // The state determines whether we guess settings or preserve them: diff --git a/src/modules/keyboard/keyboard.conf b/src/modules/keyboard/keyboard.conf index 2a8e85149..fe82a9b61 100644 --- a/src/modules/keyboard/keyboard.conf +++ b/src/modules/keyboard/keyboard.conf @@ -31,3 +31,15 @@ convertedKeymapPath: "/lib/kbd/keymaps/xkb" # Guess the default layout from the user locale. If false, keeps the current # OS keyboard layout as the default (useful if the layout is pre-configured). #guessLayout: true + +# Things that should be configured. +configure: + # Configure KWin (KDE Plasma) directly by editing the + # configuration file and informing KWin over DBus. This is + # useful in a system that uses Wayland but does **not** connect + # locale1 with KWin. + # + # Systems that use KDE Plasma Wayland and locale1 can instead start the + # compositor KWin with command-line argument `--locale1`. That + # argument makes this configuration option unnecessary. + kwin: false diff --git a/src/modules/keyboard/keyboard.schema.yaml b/src/modules/keyboard/keyboard.schema.yaml index 9db89b2e3..0fb1fdcf3 100644 --- a/src/modules/keyboard/keyboard.schema.yaml +++ b/src/modules/keyboard/keyboard.schema.yaml @@ -11,4 +11,9 @@ properties: writeEtcDefaultKeyboard: { type: boolean, default: true } useLocale1: { type: boolean, default: false } guessLayout: { type: boolean, default: true } + configure: + additionalProperties: false + type: object + properties: + kwin: { type: boolean, default: false } required: [ xOrgConfFileName, convertedKeymapPath ]