aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-04-25 16:26:40 -0400
committerKen Moore <moorekou@gmail.com>2016-04-25 16:26:40 -0400
commitf1d447d34546b4a6b3acadf4bd3554ad6ec163a3 (patch)
tree09c1180b020eb610141cfe4f245af37c52a3784f /src-qt5/core
parentAdd a .desktop entry for lumina-textedit. (diff)
downloadlumina-f1d447d34546b4a6b3acadf4bd3554ad6ec163a3.tar.gz
lumina-f1d447d34546b4a6b3acadf4bd3554ad6ec163a3.tar.bz2
lumina-f1d447d34546b4a6b3acadf4bd3554ad6ec163a3.zip
Add the beginnings of a new "lumina-session" wrapper utility for the sequentual loading of various utilities (WM, DE, screensaver, compositing manager, etc..)
Also setup lumina-session to auto-start xcompmgr if it is installed, and adjust the Lumina-DE.desktop xsession entry to launch the session instead of the Lumina-DE binary directly.
Diffstat (limited to 'src-qt5/core')
-rw-r--r--src-qt5/core/core.pro2
-rw-r--r--src-qt5/core/libLumina/LuminaUtils.cpp105
-rw-r--r--src-qt5/core/libLumina/LuminaUtils.h4
-rw-r--r--src-qt5/core/lumina-desktop/Insight-FileManager.pngbin2829 -> 0 bytes
-rw-r--r--src-qt5/core/lumina-desktop/LSession.cpp15
-rw-r--r--src-qt5/core/lumina-desktop/Lumina-DE.desktop4
-rw-r--r--src-qt5/core/lumina-desktop/WMProcess.cpp8
-rw-r--r--src-qt5/core/lumina-desktop/WMProcess.h3
8 files changed, 124 insertions, 17 deletions
diff --git a/src-qt5/core/core.pro b/src-qt5/core/core.pro
index c3227b01..029c1355 100644
--- a/src-qt5/core/core.pro
+++ b/src-qt5/core/core.pro
@@ -6,6 +6,7 @@ CONFIG += recursive
SUBDIRS+= libLumina \
lumina-desktop \
+ lumina-session \
lumina-open \
lumina-info
# lumina-wm-INCOMPLETE \
@@ -14,5 +15,6 @@ SUBDIRS+= libLumina \
#Make sure to list libLumina as a requirement for the others (for parallellized builds)
lumina-desktop.depends = libLumina
+lumina-session.depends = libLumina
lumina-open.depends = libLumina
lumina-info.depends = libLumina
diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp
index e25596f8..fa38d6df 100644
--- a/src-qt5/core/libLumina/LuminaUtils.cpp
+++ b/src-qt5/core/libLumina/LuminaUtils.cpp
@@ -783,6 +783,111 @@ void LUtils::LoadSystemDefaults(bool skipOS){
LUtils::writeFile(setdir+"/lumina-open.conf", lopenset, true);
}
+bool LUtils::checkUserFiles(QString lastversion){
+ //internal version conversion examples:
+ // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001]
+ //returns true if something changed
+ int oldversion = LUtils::VersionStringToNumber(lastversion);
+ int nversion = LUtils::VersionStringToNumber(QApplication::applicationVersion());
+ bool newversion = ( oldversion < nversion ); //increasing version number
+ bool newrelease = ( lastversion.contains("-devel", Qt::CaseInsensitive) && QApplication::applicationVersion().contains("-release", Qt::CaseInsensitive) ); //Moving from devel to release
+
+ //Check for the desktop settings file
+ QString dset = QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf";
+ bool firstrun = false;
+ if(!QFile::exists(dset) || oldversion < 5000){
+ if( oldversion < 5000 ){ QFile::remove(dset); qDebug() << "Current desktop settings obsolete: Re-implementing defaults"; }
+ else{ firstrun = true; }
+ LUtils::LoadSystemDefaults();
+ }
+ //Convert the favorites framework as necessary (change occured with 0.8.4)
+ if(newversion || newrelease){
+ LUtils::upgradeFavorites(oldversion);
+ }
+ //Convert any "userbutton" and "appmenu" panel plugins to the new "systemstart" plugin (0.8.7)
+ if(oldversion <= 8007 && (newversion || newrelease) && nversion < 8008){
+ QSettings dset(QSettings::UserScope, "LuminaDE","desktopsettings");
+ QStringList plugKeys = dset.allKeys().filter("panel").filter("/pluginlist");
+ for(int i=0; i<plugKeys.length(); i++){
+ QStringList plugs = dset.value(plugKeys[i],QStringList()).toStringList();
+ //Do the appmenu/userbutton -> systemstart conversion
+ plugs = plugs.join(";;;;").replace("userbutton","systemstart").replace("appmenu","systemstart").split(";;;;");
+ //Remove any system dashboard plugins
+ plugs.removeAll("systemdashboard");
+ //Now save that back to the file
+ dset.setValue(plugKeys[i], plugs);
+ }
+ //Also remove any "desktopview" desktop plugin and enable the automatic desktop icons instead
+ plugKeys = dset.allKeys().filter("desktop-").filter("/pluginlist");
+ for(int i=0; i<plugKeys.length(); i++){
+ QStringList plugs = dset.value(plugKeys[i], QStringList()).toStringList();
+ QStringList old = plugs.filter("desktopview");
+ bool found = !old.isEmpty();
+ for(int j=0; j<old.length(); j++){ plugs.removeAll(old[j]); }
+ if(found){
+ dset.setValue(plugKeys[i],plugs); //save the modified plugin list
+ //Also set the auto-generate flag on this desktop
+ dset.setValue(plugKeys[i].section("/",0,0)+"/generateDesktopIcons", true);
+ }
+ }
+ dset.sync();
+ //Due to the grid size change for desktop plugins, need to remove any old plugin geometries
+ if(QFile::exists(QDir::homePath()+"/.lumina/pluginsettings/desktopsettings.conf")){
+ QFile::remove(QDir::homePath()+"/.lumina/pluginsettings/desktopsettings.conf");
+ }
+ }
+
+ //Convert to the XDG autostart spec as necessary (Change occured with 0.8.5)
+ if(QFile::exists(QDir::homePath()+"/.lumina/startapps") ){
+ QStringList cmds = LUtils::readFile(QDir::homePath()+"/.lumina/startapps");
+ for(int i=0; i<cmds.length(); i++){
+ cmds[i] = cmds[i].remove("lumina-open").simplified(); //remove the file opener
+ if(cmds[i].startsWith("#") || cmds[i].isEmpty()){ continue; } //invalid line
+
+ LXDG::setAutoStarted(true, cmds[i]);
+ }
+ QFile::remove(QDir::homePath()+"/.lumina/startapps"); //delete the old file
+ }
+
+ //Check for the default applications file for lumina-open
+ dset = QDir::homePath()+"/.lumina/LuminaDE/lumina-open.conf";
+ if(!QFile::exists(dset)){
+ firstrun = true;
+ }
+ //Check the fluxbox configuration files
+ dset = QDir::homePath()+"/.lumina/";
+ bool fluxcopy = false;
+ if(!QFile::exists(dset+"fluxbox-init")){ fluxcopy=true; }
+ else if(!QFile::exists(dset+"fluxbox-keys")){fluxcopy=true; }
+ else if(oldversion < 60){ fluxcopy=true; qDebug() << "Current fluxbox settings obsolete: Re-implementing defaults"; }
+ if(fluxcopy){
+ qDebug() << "Copying default fluxbox configuration files";
+ if(QFile::exists(dset+"fluxbox-init")){ QFile::remove(dset+"fluxbox-init"); }
+ if(QFile::exists(dset+"fluxbox-keys")){ QFile::remove(dset+"fluxbox-keys"); }
+ QFile::copy(LOS::LuminaShare()+"fluxbox-init-rc", dset+"fluxbox-init");
+ QFile::copy(LOS::LuminaShare()+"fluxbox-keys", dset+"fluxbox-keys");
+ QFile::setPermissions(dset+"fluxbox-init", QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadOther | QFile::ReadGroup);
+ QFile::setPermissions(dset+"fluxbox-keys", QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadOther | QFile::ReadGroup);
+ }
+
+ if(firstrun){ qDebug() << "First time using Lumina!!"; }
+ return (firstrun || newversion || newrelease);
+}
+
+int LUtils::VersionStringToNumber(QString version){
+ version = version.section("-",0,0); //trim any extra labels off the end
+ int maj, mid, min; //major/middle/minor version numbers (<Major>.<Middle>.<Minor>)
+ maj = mid = min = 0;
+ bool ok = true;
+ maj = version.section(".",0,0).toInt(&ok);
+ if(ok){ mid = version.section(".",1,1).toInt(&ok); }else{ maj = 0; }
+ if(ok){ min = version.section(".",2,2).toInt(&ok); }else{ mid = 0; }
+ if(!ok){ min = 0; }
+ //Now assemble the number
+ //NOTE: This format allows numbers to be anywhere from 0->999 without conflict
+ return (maj*1000000 + mid*1000 + min);
+}
+
// =======================
// RESIZEMENU CLASS
// =======================
diff --git a/src-qt5/core/libLumina/LuminaUtils.h b/src-qt5/core/libLumina/LuminaUtils.h
index f0e4b88b..32109244 100644
--- a/src-qt5/core/libLumina/LuminaUtils.h
+++ b/src-qt5/core/libLumina/LuminaUtils.h
@@ -90,7 +90,9 @@ public:
//Load the default setup for the system
static void LoadSystemDefaults(bool skipOS = false);
-
+ static bool checkUserFiles(QString lastversion); //returns true if something changed
+ static int VersionStringToNumber(QString version); //convert the lumina version string to a number for comparisons
+
};
//Special subclass for a menu which the user can grab the edges and resize as necessary
diff --git a/src-qt5/core/lumina-desktop/Insight-FileManager.png b/src-qt5/core/lumina-desktop/Insight-FileManager.png
deleted file mode 100644
index 46cfaad7..00000000
--- a/src-qt5/core/lumina-desktop/Insight-FileManager.png
+++ /dev/null
Binary files differ
diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp
index d4146e77..869ef183 100644
--- a/src-qt5/core/lumina-desktop/LSession.cpp
+++ b/src-qt5/core/lumina-desktop/LSession.cpp
@@ -376,7 +376,12 @@ void LSession::checkUserFiles(){
//internal version conversion examples:
// [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001]
QString OVS = sessionsettings->value("DesktopVersion","0").toString(); //Old Version String
- int oldversion = VersionStringToNumber(OVS);
+ bool changed = LUtils::checkUserFiles(OVS);
+ if(changed){
+ //Save the current version of the session to the settings file (for next time)
+ sessionsettings->setValue("DesktopVersion", this->applicationVersion());
+ }
+ /*int oldversion = VersionStringToNumber(OVS);
int nversion = VersionStringToNumber(this->applicationVersion());
bool newversion = ( oldversion < VersionStringToNumber(this->applicationVersion()) ); //increasing version number
bool newrelease = ( OVS.contains("-devel", Qt::CaseInsensitive) && this->applicationVersion().contains("-release", Qt::CaseInsensitive) ); //Moving from devel to release
@@ -442,12 +447,6 @@ void LSession::checkUserFiles(){
dset = QDir::homePath()+"/.lumina/LuminaDE/lumina-open.conf";
if(!QFile::exists(dset)){
firstrun = true;
- /*if(QFile::exists(LOS::LuminaShare()+"defaultapps.conf")){
- if( QFile::copy(LOS::LuminaShare()+"defaultapps.conf", dset) ){
- QFile::setPermissions(dset, QFile::ReadUser | QFile::WriteUser | QFile::ReadOwner | QFile::WriteOwner);
- }
- }*/
-
}
//Check the fluxbox configuration files
dset = QDir::homePath()+"/.lumina/";
@@ -473,7 +472,7 @@ void LSession::checkUserFiles(){
//Save the current version of the session to the settings file (for next time)
if(newversion || newrelease){
sessionsettings->setValue("DesktopVersion", this->applicationVersion());
- }
+ }*/
}
void LSession::refreshWindowManager(){
diff --git a/src-qt5/core/lumina-desktop/Lumina-DE.desktop b/src-qt5/core/lumina-desktop/Lumina-DE.desktop
index f83c6a7c..7d87f93a 100644
--- a/src-qt5/core/lumina-desktop/Lumina-DE.desktop
+++ b/src-qt5/core/lumina-desktop/Lumina-DE.desktop
@@ -1,6 +1,6 @@
[Desktop Entry]
-Exec=Lumina-DE
-TryExec=Lumina-DE
+Exec=start-lumina-desktop
+TryExec=start-lumina-desktop
Icon=Lumina-DE
Type=Application
Name=Lumina
diff --git a/src-qt5/core/lumina-desktop/WMProcess.cpp b/src-qt5/core/lumina-desktop/WMProcess.cpp
index a2a4933f..29dff542 100644
--- a/src-qt5/core/lumina-desktop/WMProcess.cpp
+++ b/src-qt5/core/lumina-desktop/WMProcess.cpp
@@ -13,7 +13,7 @@ WMProcess::WMProcess() : QProcess(){
QString log = QDir::homePath()+"/.lumina/logs/wm.log";
if(QFile::exists(log)){ QFile::remove(log); }
this->setStandardOutputFile(log);
- ssaver = new QProcess(0);
+ //ssaver = new QProcess(0);
inShutdown = false;
}
@@ -28,17 +28,17 @@ void WMProcess::startWM(){
inShutdown = false;
QString cmd = setupWM();
if(!isRunning()){this->start(cmd); }
- if(ssaver->state() == QProcess::NotRunning \
+ /*if(ssaver->state() == QProcess::NotRunning \
&& LSession::handle()->sessionSettings()->value("WindowManager", "fluxbox").toString() != "lumina-wm"){
ssaver->start("xscreensaver -no-splash");
- }
+ }*/
}
void WMProcess::stopWM(){
if(isRunning()){
inShutdown = true;
//QProcess::startDetached("fluxbox-remote closeallwindows");
- ssaver->kill();
+ //ssaver->kill();
this->kill();
if(!this->waitForFinished(10000)){ this->terminate(); };
}else{
diff --git a/src-qt5/core/lumina-desktop/WMProcess.h b/src-qt5/core/lumina-desktop/WMProcess.h
index ff1b3963..b2909ee0 100644
--- a/src-qt5/core/lumina-desktop/WMProcess.h
+++ b/src-qt5/core/lumina-desktop/WMProcess.h
@@ -34,7 +34,7 @@ private:
bool isRunning();
QString setupWM();
void cleanupConfig();
- QProcess *ssaver;
+ //QProcess *ssaver;
private slots:
void processFinished(int exitcode, QProcess::ExitStatus status);
@@ -44,4 +44,3 @@ signals:
};
#endif
-
bgstack15