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

Vlad Zahorodnii <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 8932b46e20506f0b5aada06ef23ac22689d67504 by Vlad Zahorodnii.
Committed on 17/07/2026 at 10:24.
Pushed by vladz into branch 'master'.

startkde: Update LookAndFeelPackage in kdeglobals

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

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

https://invent.kde.org/plasma/plasma-workspace/-/commit/8932b46e20506f0b5aada06ef23ac22689d67504

diff --git a/startkde/CMakeLists.txt b/startkde/CMakeLists.txt
index fd7b8cad11..d18998bd91 100644
--- a/startkde/CMakeLists.txt
+++ b/startkde/CMakeLists.txt
@@ -29,6 +29,7 @@ target_link_libraries(startplasma-wayland PRIVATE
 kconfig_target_kcfg_file(startplasma-wayland
     FILE ${CMAKE_SOURCE_DIR}/kcms/lookandfeel/lookandfeelsettings.kcfg
     CLASS_NAME LookAndFeelSettings
+    MUTATORS
 )
 
 add_subdirectory(plasma-session)
diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp
index a7b81b6432..736817f53f 100644
--- a/startkde/startplasma.cpp
+++ b/startkde/startplasma.cpp
@@ -396,10 +396,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;
@@ -429,8 +427,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"));
     if (!activeLnf.open(QIODevice::ReadOnly) || activeLnf.readLine() != lookAndFeelName.toUtf8()) {
         KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"), lookAndFeelName);
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.