[plasma/plasma-workspace/Plasma/6.7] startkde: startkde: Update LookAndFeelPackage in kdeglobals

Vlad Zahorodnii <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 34ff9079cdc4dbedd8a3d0fce82402dfc66f17ff by Vlad Zahorodnii.
Committed on 17/07/2026 at 11:11.
Pushed by vladz into branch 'Plasma/6.7'.

startkde: Update LookAndFeelPackage in kdeglobals

This prevents the autoswitching module from potentially applying the new
global theme again.


(cherry picked from commit 8932b46e20506f0b5aada06ef23ac22689d67504)

Co-authored-by: Vlad Zahorodnii <[email protected]>

M  +1    -0    startkde/CMakeLists.txt
M  +9    -4    startkde/startplasma.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/34ff9079cdc4dbedd8a3d0fce82402dfc66f17ff

diff --git a/startkde/CMakeLists.txt b/startkde/CMakeLists.txt
index 74d60ced34..0e15eebcb7 100644
--- a/startkde/CMakeLists.txt
+++ b/startkde/CMakeLists.txt
@@ -30,6 +30,7 @@ target_link_libraries(startplasma PUBLIC
 kconfig_target_kcfg_file(startplasma
     FILE ${CMAKE_SOURCE_DIR}/kcms/lookandfeel/lookandfeelsettings.kcfg
     CLASS_NAME LookAndFeelSettings
+    MUTATORS
 )
 
 add_executable(startplasma-wayland ${START_PLASMA_COMMON_SRCS} startplasma-wayland.cpp)
diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp
index 75837e93ee..cc596c8f52 100644
--- a/startkde/startplasma.cpp
+++ b/startkde/startplasma.cpp
@@ -381,10 +381,8 @@ static std::optional<std::pair<QString, KLookAndFeelManager::Contents>> dayNight
     return std::make_pair(lookAndFeelName, KLookAndFeelManager::AppearanceSettings);
 }
 
-static std::pair<QString, KLookAndFeelManager::Contents> determineLookAndFeel()
+static std::pair<QString, KLookAndFeelManager::Contents> determineLookAndFeel(const LookAndFeelSettings &settings)
 {
-    const LookAndFeelSettings settings;
-
     if (settings.automaticLookAndFeel()) {
         if (const auto lookAndFeel = dayNightLookAndFeel(settings)) {
             return *lookAndFeel;
@@ -414,8 +412,15 @@ void setupPlasmaEnvironment()
     QDir().mkpath(extraConfigDir);
     qputenv("XDG_CONFIG_DIRS", QByteArray(QFile::encodeName(extraConfigDir) + ':' + currentConfigDirs));
 
-    const auto &[lookAndFeelName, lookAndFeelContents] = determineLookAndFeel();
+    LookAndFeelSettings lookAndFeelSettings;
+    const auto &[lookAndFeelName, lookAndFeelContents] = determineLookAndFeel(lookAndFeelSettings);
     qCDebug(PLASMA_STARTUP) << "Applying" << lookAndFeelName << "global theme";
+
+    if (lookAndFeelSettings.lookAndFeelPackage() != lookAndFeelName) {
+        lookAndFeelSettings.setLookAndFeelPackage(lookAndFeelName);
+        lookAndFeelSettings.save();
+    }
+
     QFile activeLnf(extraConfigDir + QLatin1String("/package"));
     activeLnf.open(QIODevice::ReadOnly);
     if (activeLnf.readLine() != lookAndFeelName.toUtf8()) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.