diff options
Diffstat (limited to 'src-qt5/core/lumina-session/session.cpp')
-rw-r--r-- | src-qt5/core/lumina-session/session.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 5f9ca6c4..0e88a227 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -95,7 +95,7 @@ void LSession::start(){ //Compositing manager QSettings settings("lumina-desktop","sessionsettings"); if(settings.value("enableCompositing",true).toBool()){ - if(LUtils::isValidBinary("compton")){ + if(LUtils::isValidBinary("compton")){ QString set = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/compton.conf"; if(!QFile::exists(set)){ if(QFile::exists(LOS::LuminaShare()+"/compton.conf")){ @@ -106,6 +106,16 @@ void LSession::start(){ qDebug() << "Using default compton settings"; startProcess("compositing","compton"); }else{ + //Auto-detect if GLX is available on the system and turn it on/off as needed + 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); + } startProcess("compositing","compton --config \""+set+"\"", QStringList() << set); } }else if(LUtils::isValidBinary("xcompmgr")){ startProcess("compositing","xcompmgr"); } |