From 1cece69cdba961c2d568a77d3144e070f0e26a9b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 26 Apr 2016 09:44:23 -0400 Subject: Oops - forgot to "git add" the new lumina-session files. --- src-qt5/core/lumina-session/lumina-session.pro | 17 ++++++ src-qt5/core/lumina-session/main.cpp | 54 +++++++++++++++++ src-qt5/core/lumina-session/session.h | 81 ++++++++++++++++++++++++++ 3 files changed, 152 insertions(+) create mode 100644 src-qt5/core/lumina-session/lumina-session.pro create mode 100644 src-qt5/core/lumina-session/main.cpp create mode 100644 src-qt5/core/lumina-session/session.h (limited to 'src-qt5/core') diff --git a/src-qt5/core/lumina-session/lumina-session.pro b/src-qt5/core/lumina-session/lumina-session.pro new file mode 100644 index 00000000..e9a6c319 --- /dev/null +++ b/src-qt5/core/lumina-session/lumina-session.pro @@ -0,0 +1,17 @@ +include($${PWD}/../../OS-detect.pri) + +QT += core widgets x11extras + + +TARGET = start-lumina-desktop +target.path = $${L_BINDIR} + + +LIBS += -lLuminaUtils -lxcb -lxcb-damage +DEPENDPATH += ../libLumina + +SOURCES += main.cpp + +HEADERS += session.h + +INSTALLS += target diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp new file mode 100644 index 00000000..0ed3067a --- /dev/null +++ b/src-qt5/core/lumina-session/main.cpp @@ -0,0 +1,54 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include +#include +#include +#include + + + + +#include "session.h" +#include +#include +#include +#include + +#define DEBUG 0 + +int main(int argc, char ** argv) +{ + if (argc > 1) { + if (QString(argv[1]) == QString("--version")){ + qDebug() << LUtils::LuminaDesktopVersion(); + return 0; + } + } + if(!QFile::exists(LOS::LuminaShare())){ + qDebug() << "Lumina does not appear to be installed correctly. Cannot find: " << LOS::LuminaShare(); + return 1; + } + //Setup any initialization values + LTHEME::LoadCustomEnvSettings(); + LXDG::setEnvironmentVars(); + setenv("DESKTOP_SESSION","Lumina",1); + setenv("XDG_CURRENT_DESKTOP","Lumina",1); + unsetenv("QT_QPA_PLATFORMTHEME"); //causes issues with Lumina themes - not many people have this by default... + //Check for any missing user config files + + //Start X11 if needed + + //Configure X11 monitors if needed + + //Startup the session + QCoreApplication a(argc, argv); + LSession sess; + sess.start(); + int retCode = a.exec(); + qDebug() << "Finished Closing Down Lumina"; + return retCode; +} diff --git a/src-qt5/core/lumina-session/session.h b/src-qt5/core/lumina-session/session.h new file mode 100644 index 00000000..7e5f1deb --- /dev/null +++ b/src-qt5/core/lumina-session/session.h @@ -0,0 +1,81 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include +#include +#include + +#include + +class LSession : public QObject{ +private: + QList PROCS; + bool stopping; + + void startProcess(QString ID, QString command){ + QString logfile = QDir::homePath()+"/.lumina/logs/"+ID+".log"; + if(QFile::exists(logfile+".old")){ QFile::remove(logfile+".old"); } + if(QFile::exists(logfile)){ QFile::rename(logfile,logfile+".old"); } + QProcess *proc = new QProcess(); + proc->setProcessChannelMode(QProcess::MergedChannels); + proc->setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); + proc->setStandardOutputFile(logfile); + proc->start(command, QIODevice::ReadOnly); + connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(procFinished()) ); + PROCS << proc; + } + +private slots: + void stopall(){ + stopping = true; + for(int i=0; istate()!=QProcess::NotRunning){ PROCS[i]->kill(); } + } + } + + void procFinished(){ + //Go through and check the status on all the procs to determine which one finished + int stopped = 0; + for(int i=0; istate()==QProcess::NotRunning){ + stopped++; + if(!stopping){ + //See if this process is the main desktop binary + if(PROCS[i]->program().section("/",-1) == "Lumina-DE"){ stopall(); } //start closing down everything + //else{ PROCS[i]->start(QIODevice::ReadOnly); } //restart the process + break; + } + } + } + if(stopping && stopped==PROCS.length()){ + QCoreApplication::exit(0); + } + } + +public: + LSession(){ + stopping = false; + } + ~LSession(){ } + + void start(){ + //First check for a valid installation + if( !LUtils::isValidBinary("fluxbox") || !LUtils::isValidBinary("Lumina-DE") ){ + exit(1); + } + //Window Manager First + // 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"); } + //startProcess("wm", "fluxbox -rc "+QDir::homePath()+"/.lumina/fluxbox-init -no-slit -no-toolbar"); + //Desktop Next + startProcess("runtime","Lumina-DE"); + //ScreenSaver + if(LUtils::isValidBinary("xscreensaver")){ startProcess("screensaver","xscreensaver -no-splash"); } + //Compositing manager + if(LUtils::isValidBinary("xcompmgr")){ startProcess("compositing","xcompmgr"); } + } + +}; -- cgit