From 4a4064045db1350c6a6dedb9fe6ecdac7bc8ea37 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Sat, 23 Mar 2019 09:18:50 -0400 Subject: Fix up the loading order for initial file copies. This should ensure the template files are copied before the system settings are loaded to change the templates. --- src-qt5/core/lumina-session/session.cpp | 81 +++++++++++++++++++-------------- src-qt5/core/lumina-session/session.h | 3 ++ 2 files changed, 49 insertions(+), 35 deletions(-) diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 606ab1d9..c3367bc1 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -18,6 +18,49 @@ #include #include +bool LSession::setupFluxboxFiles(){ + QString confDir = QString( getenv("XDG_CONFIG_HOME"))+"/lumina-desktop"; + if(!QFile::exists(confDir)){ QDir dir(confDir); dir.mkpath(confDir); } + if(!QFile::exists(confDir+"/fluxbox-init")){ + QStringList keys = LUtils::readFile(LOS::LuminaShare()+"/fluxbox-init-rc"); + keys = keys.replaceInStrings("${XDG_CONFIG_HOME}", QString( getenv("XDG_CONFIG_HOME"))); + LUtils::writeFile(confDir+"/fluxbox-init", keys, true); + QFile::setPermissions(confDir+"/fluxbox-init", QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadOther | QFile::ReadGroup); + } + if(!QFile::exists(confDir+"/fluxbox-keys")){ + QStringList keys = LUtils::readFile(LOS::LuminaShare()+"/fluxbox-keys"); + keys = keys.replaceInStrings("${XDG_CONFIG_HOME}", QString( getenv("XDG_CONFIG_HOME"))); + LUtils::writeFile(confDir+"/fluxbox-keys", keys, true); + QFile::setPermissions(confDir+"/fluxbox-keys", QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadOther | QFile::ReadGroup); + } + if(!QFile::exists(confDir+"/fluxbox-overlay")){ + QStringList contents; contents << "background: unset"; + LUtils::writeFile(confDir+"/fluxbox-overlay", contents, true); + //Now make sure this overlay file is set within the init file + contents = LUtils::readFile(confDir+"/fluxbox-init"); + contents << "session.styleOverlay: "+confDir+"/fluxbox-overlay"; + LUtils::writeFile(confDir+"/fluxbox-init", contents, true); + } + // FLUXBOX BUG BYPASS: if the ~/.fluxbox dir does not exist, it will ignore the given config file + if(!QFile::exists(QDir::homePath()+"/.fluxbox")){ + QDir dir; dir.mkpath(QDir::homePath()+"/.fluxbox"); + } + return true; +} + +bool LSession::setupComptonFiles(){ + QString set = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/compton.conf"; + bool replaceconf = !QFile::exists(set); + if(!replaceconf){ replaceconf = (QFileInfo(set).size()<1); } + if( replaceconf ){ + if(QFile::exists(set)){ QFile::remove(set); } + if(QFile::exists(LOS::LuminaShare()+"/compton.conf")){ + QFile::copy(LOS::LuminaShare()+"/compton.conf", set); + } + } + return true; +} + void LSession::stopall(){ stopping = true; for(int i=0; i 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] qDebug() << "[Lumina] Checking User Files"; + setupComptonFiles(); + setupFluxboxFiles(); QSettings sset("lumina-desktop", "sessionsettings"); QString OVS = sset.value("DesktopVersion","0").toString(); //Old Version String qDebug() << " - Old Version:" << OVS; diff --git a/src-qt5/core/lumina-session/session.h b/src-qt5/core/lumina-session/session.h index 8d61df42..0c7ff97c 100644 --- a/src-qt5/core/lumina-session/session.h +++ b/src-qt5/core/lumina-session/session.h @@ -18,6 +18,7 @@ class LProcess : public QProcess{ private: QFileSystemWatcher *watcher; QString id; + private slots: void filechanged(QString path){ //qDebug() << "File Changed:" << path; @@ -63,6 +64,8 @@ private: int wmfails; QTimer *wmTimer; + bool setupFluxboxFiles(); + bool setupComptonFiles(); void setupCompositor(bool force = false); private slots: -- cgit