aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-session
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-session')
-rw-r--r--src-qt5/core/lumina-session/main.cpp7
-rw-r--r--src-qt5/core/lumina-session/session.cpp9
-rw-r--r--src-qt5/core/lumina-session/session.h26
3 files changed, 31 insertions, 11 deletions
diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp
index 3696ed20..71244a8b 100644
--- a/src-qt5/core/lumina-session/main.cpp
+++ b/src-qt5/core/lumina-session/main.cpp
@@ -21,6 +21,11 @@
#include <unistd.h>
#define DEBUG 0
+int findAvailableSession(){
+ int num = 0;
+ while(QFile::exists("/tmp/.X11-unix/X"+QString::number(num))){ num++; }
+ return num;
+}
int main(int argc, char ** argv)
{
@@ -45,7 +50,7 @@ int main(int argc, char ** argv)
QString prog = QString(argv[0]).section("/",-1);
LUtils::isValidBinary(prog); //will adjust the path to be absolute
if(unified){ prog = prog+" --unified"; }
- QStringList args; args << prog;
+ QStringList args; args << prog << "--" << ":"+QString::number(findAvailableSession());
//if(LUtils::isValidBinary("x11vnc")){ args << "--" << "-listen" << "tcp"; } //need to be able to VNC into this session
return QProcess::execute("xinit", args);
}
diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp
index de9b86ee..3fdf9e66 100644
--- a/src-qt5/core/lumina-session/session.cpp
+++ b/src-qt5/core/lumina-session/session.cpp
@@ -39,6 +39,7 @@ void LSession::procFinished(){
if(!stopping){
//See if this process is the main desktop binary
if(PROCS[i]->objectName()=="runtime"){ stopall(); }
+ else if(PROCS[i]->objectName()=="wm" && wmfails<2){ wmfails++; PROCS[i]->start(QIODevice::ReadOnly); wmTimer->start(); } //restart the WM
//if(PROCS[i]->program().section("/",-1) == "lumina-desktop"){ stopall(); } //start closing down everything
//else{ PROCS[i]->start(QIODevice::ReadOnly); } //restart the process
//break;
@@ -85,11 +86,17 @@ void LSession::start(bool unified){
if(!LUtils::isValidBinary("lumina-desktop") ){
exit(1);
}
+ setenv("DESKTOP_SESSION","Lumina",1);
+ setenv("XDG_CURRENT_DESKTOP","Lumina",1);
+ setenv("QT_QPA_PLATFORMTHEME","lthemeengine", true);
+ setenv("QT_NO_GLIB", "1", 1); //Disable the glib event loop within Qt at runtime (performance hit + bugs)
+ unsetenv("QT_AUTO_SCREEN_SCALE_FACTOR"); //need exact-pixel measurements (no fake scaling)
+
if(!unified){
QSettings sessionsettings("lumina-desktop","sessionsettings");
QString WM = sessionsettings.value("WindowManager", "fluxbox").toString();
//Window Manager First
- if(WM=="fluxbox"){
+ if(WM=="fluxbox" || WM.endsWith("/fluxbox") || WM.simplified().isEmpty() ){
// FLUXBOX BUG BYPASS: if the ~/.fluxbox dir does not exist, it will ignore the given config file
if( !LUtils::isValidBinary("fluxbox") ){
qDebug() << "[INCOMPLETE LUMINA INSTALLATION] fluxbox binary is missing - cannot continue";
diff --git a/src-qt5/core/lumina-session/session.h b/src-qt5/core/lumina-session/session.h
index 99127c07..5cf1ccfa 100644
--- a/src-qt5/core/lumina-session/session.h
+++ b/src-qt5/core/lumina-session/session.h
@@ -8,6 +8,7 @@
#include <QProcess>
#include <QDebug>
#include <QFileSystemWatcher>
+#include <QTimer>
#include <sys/types.h>
#include <signal.h>
@@ -19,15 +20,15 @@ private:
QString id;
private slots:
void filechanged(QString path){
- qDebug() << "File Changed:" << path;
- qDebug() << " - Program:" << this->program();
+ //qDebug() << "File Changed:" << path;
+ //qDebug() << " - Program:" << this->program();
if(watcher==0){ return; } //just in case
if(this->state()==QProcess::Running){
- if(this->program().section(" ",0,0).section("/",-1) == "fluxbox" ){
- qDebug() << "Sending Fluxbox signal to reload configs...";
+ if(this->program().section(" ",0,0).section("/",-1) == "fluxbox" ){
+ // qDebug() << "Sending Fluxbox signal to reload configs...";
::kill(this->pid(), SIGUSR2); } //Fluxbox needs SIGUSR2 to reload it's configs
- else if(this->program().section(" ",0,0).section("/",-1) == "compton" ){
- qDebug() << "Sending Compton signal to reload configs...";
+ else if(this->program().section(" ",0,0).section("/",-1) == "compton" ){
+ //qDebug() << "Sending Compton signal to reload configs...";
::kill(this->pid(), SIGUSR1); } //Compton needs SIGUSR1 to reload it's configs
}
//Now make sure this file/dir was not removed from the watcher
@@ -40,7 +41,7 @@ public:
id=ID;
watcher = 0;
if(!watchfiles.isEmpty()){
- qDebug() << "Watch Files for changes:" << ID << watchfiles;
+ //qDebug() << "Watch Files for changes:" << ID << watchfiles;
watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(filechanged(QString)) );
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(filechanged(QString)) );
@@ -59,6 +60,8 @@ class LSession : public QObject{
private:
QList<QProcess*> PROCS;
bool stopping;
+ int wmfails;
+ QTimer *wmTimer;
private slots:
void stopall();
@@ -67,12 +70,17 @@ private slots:
void startProcess(QString ID, QString command, QStringList watchfiles = QStringList());
+ void resetWMCounter(){ wmfails = 0; }
public:
LSession(){
- stopping = false;
+ stopping = false; wmfails = 0;
+ wmTimer = new QTimer(this);
+ wmTimer->setSingleShot(true);
+ wmTimer->setInterval(2000); //2 second timeout
+ connect(wmTimer, SIGNAL(timeout()), this, SLOT(resetWMCounter()) );
}
~LSession(){ }
void start(bool unified = false);
-
+
};
bgstack15