From d9e0a1339e4718c9c7711d3356daad8138e34ac2 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 28 May 2019 17:35:49 +0200 Subject: [PATCH] startup: Can't know things change if they are not exported --- startkde/kstartupconfig/kdostartupconfig.cpp | 4 ++-- startkde/startplasma.cpp | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/startkde/kstartupconfig/kdostartupconfig.cpp b/startkde/kstartupconfig/kdostartupconfig.cpp index 4016418bd..0e6f09e09 100644 --- a/startkde/kstartupconfig/kdostartupconfig.cpp +++ b/startkde/kstartupconfig/kdostartupconfig.cpp @@ -108,7 +108,7 @@ int main( int argc, char **argv ) { QString key = it.key(); QString value = *it; - startupconfig << file.replace( ' ', '_' ).toLower() + startupconfig << "export " << file.replace( ' ', '_' ).toLower() << "_" << group.replace( ' ', '_' ).toLower() << "_" << key.replace( ' ', '_' ).toLower() << "=" << KShell::quoteArg( value ) << "\n"; @@ -122,7 +122,7 @@ int main( int argc, char **argv ) KConfigGroup cg(&cfg, group ); QString value = cg.readEntry( key, def ); startupconfig << "# " << line << "\n"; - startupconfig << file.replace( ' ', '_' ).toLower() + startupconfig << "export " << file.replace( ' ', '_' ).toLower() << "_" << group.replace( ' ', '_' ).toLower() << "_" << key.replace( ' ', '_' ).toLower() << "=" << KShell::quoteArg( value ) << "\n"; diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp index b939c9ce0..b159b0d00 100644 --- a/startkde/startplasma.cpp +++ b/startkde/startplasma.cpp @@ -95,6 +95,7 @@ void sourceFiles(const QStringList &files) filteredFiles.prepend(CMAKE_INSTALL_FULL_LIBEXECDIR "/plasma-sourceenv.sh"); QProcess p; + qDebug() << "sourcing..." << filteredFiles; p.start("/bin/sh", filteredFiles); p.waitForFinished(-1); @@ -102,11 +103,17 @@ void sourceFiles(const QStringList &files) auto envs = fullEnv.split('\n'); for (auto &env: envs) { + if (env.startsWith("_=")) + continue; + const int idx = env.indexOf('='); - if (Q_UNLIKELY(idx > 0)) + if (Q_UNLIKELY(idx <= 0)) continue; - qputenv(env.left(idx), env.mid(idx+1)); + if (qgetenv(env.left(idx)) != env.mid(idx+1)) { + qDebug() << "setting..." << env.left(idx) << env.mid(idx+1) << "was" << qgetenv(env.left(idx)); + qputenv(env.left(idx), env.mid(idx+1)); + } } } @@ -300,22 +307,22 @@ void setupFontDpi() const QByteArray input = "Xft.dpi: kcmfonts_general_forcefontdpi"; QProcess p; p.start("xrdb", { "-quiet", "-merge", "-nocpp" }); -// qDebug() << "started..." << program << args; p.setProcessChannelMode(QProcess::ForwardedChannels); p.write(input); p.closeWriteChannel(); p.waitForFinished(-1); } -static int dl = -1; +static bool dl = false; QProcess* setupKSplash() { - dl = qEnvironmentVariableIntValue("DESKTOP_LOCKED"); + const auto dlstr = qgetenv("DESKTOP_LOCKED"); + dl = dlstr == "true" || dlstr == "1"; qunsetenv("DESKTOP_LOCKED"); // Don't want it in the environment QProcess* p = nullptr; - if (dl) { + if (!dl) { const auto ksplashrc_ksplash_engine = qgetenv("ksplashrc_ksplash_engine"); // the splashscreen and progress indicator if (ksplashrc_ksplash_engine == "KSplashQML") {