diff options
Diffstat (limited to 'src-qt5/core/lumina-session')
-rw-r--r-- | src-qt5/core/lumina-session/lumina-session.pro | 8 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/main.cpp | 26 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/session.cpp | 19 |
3 files changed, 40 insertions, 13 deletions
diff --git a/src-qt5/core/lumina-session/lumina-session.pro b/src-qt5/core/lumina-session/lumina-session.pro index 91a5f891..4b06ad60 100644 --- a/src-qt5/core/lumina-session/lumina-session.pro +++ b/src-qt5/core/lumina-session/lumina-session.pro @@ -1,14 +1,14 @@ include($${PWD}/../../OS-detect.pri) -QT = core widgets +QT = core widgets x11extras TARGET = start-lumina-desktop target.path = $${L_BINDIR} - -LIBS += -lLuminaUtils -DEPENDPATH += ../libLumina +include(../libLumina/LDesktopUtils.pri) +include(../libLumina/LuminaXDG.pri) +include(../libLumina/LuminaThemes.pri) SOURCES += main.cpp \ session.cpp diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp index 77e553d4..0e076ac3 100644 --- a/src-qt5/core/lumina-session/main.cpp +++ b/src-qt5/core/lumina-session/main.cpp @@ -8,20 +8,25 @@ #include <QCoreApplication> #include <QProcess> #include <QString> +#include <QLockFile> +#include <QX11Info> #include "session.h" -#include <LuminaUtils.h> +#include <LUtils.h> +#include <LDesktopUtils.h> #include <LuminaOS.h> #include <LuminaThemes.h> #include <LuminaXDG.h> +#include <unistd.h> + #define DEBUG 0 int main(int argc, char ** argv) { if (argc > 1) { if (QString(argv[1]) == QString("--version")){ - qDebug() << LUtils::LuminaDesktopVersion(); + qDebug() << LDesktopUtils::LuminaDesktopVersion(); return 0; } } @@ -32,6 +37,7 @@ int main(int argc, char ** argv) //Start X11 if needed QString disp = QString(getenv("DISPLAY")).simplified(); if(disp.isEmpty()){ + qDebug() << "No X11 session detected: Lumina will try to start one..."; //No X session found. Go ahead and re-init this binary within an xinit call QString prog = QString(argv[0]).section("/",-1); LUtils::isValidBinary(prog); //will adjust the path to be absolute @@ -39,6 +45,7 @@ int main(int argc, char ** argv) //if(LUtils::isValidBinary("x11vnc")){ args << "--" << "-listen" << "tcp"; } //need to be able to VNC into this session return QProcess::execute("xinit", args); } + qDebug() << "Starting the Lumina desktop on current X11 session:" << disp; //Setup any initialization values LTHEME::LoadCustomEnvSettings(); LXDG::setEnvironmentVars(); @@ -48,11 +55,26 @@ int main(int argc, char ** argv) //Check for any missing user config files + //Check for any stale desktop lock files and clean them up + QString cfile = QDir::tempPath()+"/.LSingleApp-%1-%2-%3"; + cfile = cfile.arg( QString(getlogin()), "lumina-desktop", QString::number(QX11Info::appScreen()) ); + if(QFile::exists(cfile)){ + qDebug() << "Found Desktop Lock for X session:" << disp; + qDebug() << " - Disabling Lock and starting new desktop session"; + QLockFile lock(cfile+"-lock"); + if(lock.isLocked()){ lock.unlock(); } + QFile::remove(cfile); + } + if(QFile::exists(QDir::tempPath()+"/.luminastopping")){ + QFile::remove(QDir::tempPath()+"/.luminastopping"); + } //Configure X11 monitors if needed if(LUtils::isValidBinary("lumina-xconfig")){ + qDebug() << " - Resetting monitor configuration to last-used settings"; QProcess::execute("lumina-xconfig --reset-monitors"); } + qDebug() << " - Starting the session..."; //Startup the session QCoreApplication a(argc, argv); LSession sess; diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 2647e58d..19acdb1c 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -13,7 +13,7 @@ #include <QSettings> #include <QDir> -#include <LuminaUtils.h> +#include <LUtils.h> #include <LuminaOS.h> void LSession::stopall(){ @@ -25,7 +25,7 @@ void LSession::stopall(){ for(int i=0; i<PROCS.length(); i++){ if(PROCS[i]->state()!=QProcess::NotRunning){ PROCS[i]->terminate(); } } - //QCoreApplication::exit(0); + QCoreApplication::exit(0); } void LSession::procFinished(){ @@ -61,11 +61,16 @@ void LSession::startProcess(QString ID, QString command, QStringList watchfiles) proc->setStandardOutputFile(logfile); proc->setObjectName(ID); if(ID=="runtime"){ - //Bypass for a hidden dbus requirement for Qt itself (Qt 5.5.1) - QDir tmp = QDir::temp(); - if( tmp.entryList(QStringList() << "dbus-*").isEmpty() && LUtils::isValidBinary("dbus-launch")){ - command.prepend("dbus-launch --exit-with-session "); - } + //Bypass for a hidden dbus file requirement for Qt itself (Qt 5.5.1+?) + if(!QFile::exists("/etc/machine-id") && !QFile::exists("/var/db/dbus/machine-id")){ + if(LUtils::isValidBinary("dbus-uuidgen") && LUtils::runCmd("dbus-uuidgen --ensure") ){ } //good - the UUID was created successfully + else if(LUtils::isValidBinary("dbus-launch")){ command.prepend("dbus-launch --exit-with-session "); } + else{ + //create a simple DBUS UUID and put it in the universal-fallback location (OS-independent) + // TO-DO - root vs user level permissions issue? + qDebug() << "Could not find '/etc/machine-id' or '/var/db/dbus/machine-id': Qt will most likely crash. \nPlease run 'dbus-uuidgen --ensure' with root permissions to generate this file if Lumina does not start properly."; + } + } } proc->start(command, QIODevice::ReadOnly); connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(procFinished()) ); |