aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-session/main.cpp
diff options
context:
space:
mode:
authorWeblate <noreply@weblate.org>2016-12-14 21:52:08 +0000
committerWeblate <noreply@weblate.org>2016-12-14 21:52:08 +0000
commitf274dd0526568b50e113baa85fcb26a87575eed9 (patch)
treecabcdb147e5dbf2cbe4c321c5ad59963c40c3e89 /src-qt5/core/lumina-session/main.cpp
parentTranslated using Weblate (lumina_CONFIG@sl (generated)) (diff)
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-f274dd0526568b50e113baa85fcb26a87575eed9.tar.gz
lumina-f274dd0526568b50e113baa85fcb26a87575eed9.tar.bz2
lumina-f274dd0526568b50e113baa85fcb26a87575eed9.zip
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/core/lumina-session/main.cpp')
-rw-r--r--src-qt5/core/lumina-session/main.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp
index 464302a7..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,11 +37,15 @@ 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
- QStringList args; args << QCoreApplication::applicationFilePath();
- if(LUtils::isValidBinary("x11vnc")){ args << "--" << "-listen" << "tcp"; } //need to be able to VNC into this session
+ QString prog = QString(argv[0]).section("/",-1);
+ LUtils::isValidBinary(prog); //will adjust the path to be absolute
+ QStringList args; args << prog;
+ //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();
@@ -46,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;
bgstack15