aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-session/session.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-session/session.cpp')
-rw-r--r--src-qt5/core/lumina-session/session.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp
index 5f9ca6c4..937f05d0 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,9 +106,21 @@ void LSession::start(){
qDebug() << "Using default compton settings";
startProcess("compositing","compton");
}else{
- startProcess("compositing","compton --config \""+set+"\"", QStringList() << 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){ startProcess("compositing","compton --config \""+set+"\"", QStringList() << set); }
}
- }else if(LUtils::isValidBinary("xcompmgr")){ startProcess("compositing","xcompmgr"); }
+ }else if(LUtils::isValidBinary("xcompmgr") && !settings.value("compositingWithGpuAccelOnly",true).toBool() ){ startProcess("compositing","xcompmgr"); }
}
//Desktop Next
startProcess("runtime","lumina-desktop");
bgstack15