diff options
author | ZackaryWelch <welch.zackary@gmail.com> | 2018-04-18 11:37:51 -0400 |
---|---|---|
committer | ZackaryWelch <welch.zackary@gmail.com> | 2018-04-18 11:37:51 -0400 |
commit | 727a1a17ecf0b534b7d6132326849b9efb760c07 (patch) | |
tree | f210f19bad2f19420fbbe175e1b886fdb64b8d9f /src-qt5/core/lumina-session/session.cpp | |
parent | Muted unused variable warnings in the Poppler backend (diff) | |
parent | Clean up the default fluxbox key bindings: (diff) | |
download | lumina-727a1a17ecf0b534b7d6132326849b9efb760c07.tar.gz lumina-727a1a17ecf0b534b7d6132326849b9efb760c07.tar.bz2 lumina-727a1a17ecf0b534b7d6132326849b9efb760c07.zip |
Merge branch 'master' of http://github.com/trueos/lumina
Diffstat (limited to 'src-qt5/core/lumina-session/session.cpp')
-rw-r--r-- | src-qt5/core/lumina-session/session.cpp | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 743fc396..0f0a99eb 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -42,7 +42,7 @@ void LSession::procFinished(){ if(PROCS[i]->objectName()=="runtime"){ qDebug() << "Got Desktop Process Finished:" << PROCS[i]->exitCode(); //if(PROCS[i]->exitCode()==787){ PROCS[i]->start(QIODevice::ReadOnly); } //special internal restart code - //else{ + //else{ 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 @@ -53,14 +53,29 @@ void LSession::procFinished(){ } //qDebug() << " - Final Count:" << stopped << stopping; if(stopping || stopped==PROCS.length()){ + //Note about compton: It does not like running multiple sessions under the *same user* + // (even on different displays). Run a blanket killall on it when closing down so that + // any other Lumina sessions will automatically restart compton on that specific display + QProcess::execute("killall compton"); QCoreApplication::exit(0); + }else{ + //Make sure we restart the process as needed + for(int i=0; i<PROCS.length(); i++){ + if(PROCS[i]->state()==QProcess::NotRunning){ + //runtime/wm processes have special restart rules above + if(PROCS[i]->objectName()!="runtime" && PROCS[i]->objectName()!="wm"){ + PROCS[i]->start(QIODevice::ReadOnly); + } + } + } } } void LSession::startProcess(QString ID, QString command, QStringList watchfiles){ QString dir = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/logs"; + QString display = QString(getenv("DISPLAY")).section(":",1,1); if(!QFile::exists(dir)){ QDir tmp(dir); tmp.mkpath(dir); } - QString logfile = dir+"/"+ID+".log"; + QString logfile = dir+"/"+ID+"_"+display+".log"; if(QFile::exists(logfile+".old")){ QFile::remove(logfile+".old"); } if(QFile::exists(logfile)){ QFile::rename(logfile,logfile+".old"); } @@ -86,6 +101,37 @@ void LSession::startProcess(QString ID, QString command, QStringList watchfiles) PROCS << proc; } +void LSession::setupCompositor(){ + //Compositing manager + QSettings settings("lumina-desktop","sessionsettings"); + if(settings.value("enableCompositing",false).toBool()){ + if(LUtils::isValidBinary("compton")){ + //Compton available - check the config file + QString set = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/compton.conf"; + if(!QFile::exists(set)){ + if(QFile::exists(LOS::LuminaShare()+"/compton.conf")){ + QFile::copy(LOS::LuminaShare()+"/compton.conf", set); + } + } + //Auto-detect if GLX is available on the system and turn it on/off as needed + bool startcompton = true; + if(LUtils::isValidBinary("glxinfo")){ + bool hasAccel =! LUtils::getCmdOutput("glxinfo -B").filter("direct rendering:").filter("Yes").isEmpty(); + qDebug() << "Detected GPU Acceleration:" << hasAccel; + QStringList info = LUtils::readFile(set); + for(int i=0; i<info.length(); i++){ + if(info[i].section("=",0,0).simplified()=="backend"){ info[i] = QString("backend = \"")+ (hasAccel ? "glx" : "xrender")+"\""; break; } //replace this line + } + LUtils::writeFile(set, info, true); + if( !hasAccel && settings.value("compositingWithGpuAccelOnly",true).toBool() ){ startcompton = false; } + } + QString disp = getenv("DISPLAY"); + if(startcompton && QFile::exists(set)){ startProcess("compositing","compton -d "+disp+" --config \""+set+"\"", QStringList() << set); } + else if(startcompton){ startProcess("compositing","compton -d "+disp); } + }else if(LUtils::isValidBinary("xcompmgr") && !settings.value("compositingWithGpuAccelOnly",true).toBool() ){ startProcess("compositing","xcompmgr"); } + } +} + void LSession::start(bool unified){ //First check for a valid installation if(!LUtils::isValidBinary("lumina-desktop") ){ @@ -128,32 +174,7 @@ void LSession::start(bool unified){ startProcess("wm", cmd, QStringList() << confDir+"/fluxbox-init" << confDir+"/fluxbox-keys"); } //Compositing manager - QSettings settings("lumina-desktop","sessionsettings"); - if(settings.value("enableCompositing",false).toBool()){ - if(LUtils::isValidBinary("compton")){ - //Compton available - check the config file - QString set = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/compton.conf"; - if(!QFile::exists(set)){ - if(QFile::exists(LOS::LuminaShare()+"/compton.conf")){ - QFile::copy(LOS::LuminaShare()+"/compton.conf", set); - } - } - //Auto-detect if GLX is available on the system and turn it on/off as needed - bool startcompton = true; - if(LUtils::isValidBinary("glxinfo")){ - bool hasAccel =! LUtils::getCmdOutput("glxinfo -B").filter("direct rendering:").filter("Yes").isEmpty(); - qDebug() << "Detected GPU Acceleration:" << hasAccel; - QStringList info = LUtils::readFile(set); - for(int i=0; i<info.length(); i++){ - if(info[i].section("=",0,0).simplified()=="backend"){ info[i] = QString("backend = \"")+ (hasAccel ? "glx" : "xrender")+"\""; break; } //replace this line - } - LUtils::writeFile(set, info, true); - if( !hasAccel && settings.value("compositingWithGpuAccelOnly",true).toBool() ){ startcompton = false; } - } - if(startcompton && QFile::exists(set)){ startProcess("compositing","compton --config \""+set+"\"", QStringList() << set); } - else if(startcompton){ startProcess("compositing","compton"); } - }else if(LUtils::isValidBinary("xcompmgr") && !settings.value("compositingWithGpuAccelOnly",true).toBool() ){ startProcess("compositing","xcompmgr"); } - } + setupCompositor(); } else { if(!LUtils::isValidBinary(WM)){ exit(1); @@ -166,6 +187,7 @@ void LSession::start(bool unified){ if(LUtils::isValidBinary("xscreensaver")){ startProcess("screensaver","xscreensaver -no-splash"); } }else{ //unified process + setupCompositor(); startProcess("runtime","lumina-desktop-unified"); } } |