aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h1
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp58
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h8
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp87
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.h38
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h58
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.cpp10
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri7
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h4
-rw-r--r--src-qt5/core/lumina-session/session.cpp78
-rw-r--r--src-qt5/core/lumina-session/session.h2
14 files changed, 307 insertions, 52 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
index edde5ed7..32f84f93 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
@@ -129,6 +129,8 @@ void DesktopManager::NewWindowAvailable(NativeWindowObject* win){
#ifdef USE_WIDGETS
qDebug() << "Got New Widget Window:" << win->name();
NativeWindow *tmp = new NativeWindow(win);
+ //Lumina::NWS->RequestReparent(win->id(), win->frameId(), tmp->relativeOrigin());
+ QTimer::singleShot(10, tmp, SLOT(initProperties()) );
#endif
syncWindowList();
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h
index 945deec0..5ae75ea4 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h
@@ -41,6 +41,7 @@ public:
Q_INVOKABLE int height();
Q_INVOKABLE bool isVertical();
Q_INVOKABLE QStringList plugins();
+ Q_INVOKABLE QRect geometry(){ return geom; }
public slots:
void setBackground(QString fileOrColor);
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
index 44b2d715..86dd8482 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
@@ -6,11 +6,34 @@
//===========================================
#include "NativeWindow.h"
+#include <QWidget>
+#include <QWindow>
+
// === PUBLIC ===
NativeWindow::NativeWindow( NativeWindowObject *obj ) : QFrame(0, Qt::Window | Qt::FramelessWindowHint){
WIN = obj;
createFrame();
- WIN->addFrameWinID(this->winId());
+ WIN->addFrameWinID(container->winId());
+}
+
+NativeWindow::~NativeWindow(){
+ vlayout->deleteLater();
+ toolbarL->deleteLater();
+}
+
+QPoint NativeWindow::relativeOrigin(){
+ //Update all the margins for the frame
+ /*QList<int> frame = WIN->property(NativeWindowObject::FrameExtents).value<QList<int> >();
+ //QList<int> : [Left, Right, Top, Bottom] in pixels
+ int topM = frame[2] - titleLabel->fontMetrics().height(); //figure out how much extra we have to work with
+ if(topM<0){ topM = 0; }
+ int botM = topM/2.0;
+ QPoint containerCorner(frame[0], topM-botM);
+ return containerCorner;*/
+ return QPoint(0,0);
+}
+
+void NativeWindow::initProperties(){
//Setup all the property connections
connect(WIN, SIGNAL(winImageChanged()), this, SLOT(syncWinImage()) );
connect(WIN, SIGNAL(nameChanged()), this, SLOT(syncName()) );
@@ -21,28 +44,24 @@ NativeWindow::NativeWindow( NativeWindowObject *obj ) : QFrame(0, Qt::Window | Q
connect(WIN, SIGNAL(winTypeChanged()), this, SLOT(syncWinType()) );
connect(WIN, SIGNAL(geomChanged()), this, SLOT(syncGeom()) );
connect(WIN, SIGNAL(WindowClosed(WId)), this, SLOT(deleteLater()) );
+
+ //Setup all the button connections
+ connect(minB, SIGNAL(clicked()), WIN, SLOT(toggleVisibility()) );
+ connect(maxB, SIGNAL(clicked()), WIN, SLOT(toggleMaximize()) );
+ connect(closeB, SIGNAL(clicked()), WIN, SLOT(requestClose()) );
+
//Now Perform the initial property loads
syncWinImage();
syncName();
syncTitle();
syncIcon();
syncSticky();
- syncVisibility();
syncWinType();
syncGeom();
- //Setup all the button connections
- connect(minB, SIGNAL(clicked()), WIN, SLOT(toggleVisibility()) );
- connect(maxB, SIGNAL(clicked()), WIN, SLOT(toggleMaximize()) );
- connect(closeB, SIGNAL(clicked()), WIN, SLOT(requestClose()) );
-
+ syncVisibility(true); //init visibility - force it visible to start with
}
-NativeWindow::~NativeWindow(){
- vlayout->deleteLater();
- toolbarL->deleteLater();
-}
-
// === PRIVATE ===
void NativeWindow::createFrame(){
//Initialize the widgets
@@ -62,7 +81,8 @@ void NativeWindow::createFrame(){
vlayout->setSpacing(0);
toolbarL = new QHBoxLayout();
toolbarL->setSpacing(0);
-
+ container = QWidget::createWindowContainer(QWindow::fromWinId(WIN->id()), this);
+ container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//vlayout.align
titleLabel = new QLabel(this);
titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
@@ -75,7 +95,7 @@ void NativeWindow::createFrame(){
toolbarL->addWidget(maxB);
toolbarL->addWidget(closeB);
vlayout->addLayout(toolbarL);
- vlayout->addStretch();
+ vlayout->addWidget(container);
this->setLayout(vlayout);
// Load the icons for the buttons
loadIcons();
@@ -112,9 +132,13 @@ void NativeWindow::syncSticky(){
qDebug() << "Got Sticky Change:" << WIN->isSticky();
}
-void NativeWindow::syncVisibility(){
- qDebug() << "Sync Visibility:" << WIN->isVisible();
- this->setVisible(WIN->isVisible());
+void NativeWindow::syncVisibility(bool init){
+ if(init){
+ WIN->setProperty(NativeWindowObject::Visible, true, true); //force it
+ }else{
+ qDebug() << "Sync Visibility:" << WIN->isVisible();
+ this->setVisible(WIN->isVisible());
+ }
}
void NativeWindow::syncWinType(){
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h
index 1d87ed71..f2fd822c 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h
@@ -16,6 +16,11 @@ public:
NativeWindow(NativeWindowObject *obj);
~NativeWindow();
+ QPoint relativeOrigin(); //origin of the embedded window relative to the frame
+
+public slots:
+ void initProperties();
+
private:
//Core object
NativeWindowObject *WIN;
@@ -27,6 +32,7 @@ private:
QHBoxLayout *toolbarL;
QVBoxLayout *vlayout;
QLabel *titleLabel;
+ QWidget *container;
// Info cache variables
QRect oldgeom;
@@ -38,7 +44,7 @@ private slots:
void syncTitle();
void syncIcon();
void syncSticky();
- void syncVisibility();
+ void syncVisibility(bool init = false);
void syncWinType();
void syncGeom();
};
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp
new file mode 100644
index 00000000..3f75e8c8
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp
@@ -0,0 +1,87 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "Panel.h"
+
+// PUBLIC
+Panel::Panel(PanelObject *pobj) : QWidget(0, Qt::Window | Qt::FramelessWindowHint){
+ this->setObjectName("LuminaPanelBackgroundWidget");
+ obj = pobj;
+ layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
+ this->setBackgroundRole(QPalette::AlternateBase);
+ connect(obj, SIGNAL(backgroundChanged()), this, SLOT(updateBackground()) );
+ connect(obj, SIGNAL(geomChanged()), this, SLOT(updateGeom()) );
+ connect(obj, SIGNAL(pluginsChanged()), this, SLOT(updatePlugins()) );
+ connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) );
+ updateGeom();
+ updateBackground();
+ updatePlugins();
+ this->showNormal();
+}
+
+Panel::~Panel(){
+
+}
+
+// PRIVATE
+Plugin* Panel::findPlugin(QString id){
+ for(int i=0; i<PLUGINS.count(); i++){
+ if(PLUGINS[i]->id()==id){ return PLUGINS[i]; }
+ }
+ return 0;
+}
+
+Plugin* Panel::createPlugin(QString id){
+
+ return 0;
+}
+
+// PRIVATE SLOTS
+void Panel::objectDestroyed(QObject *dobj){
+ if(dobj == Q_NULLPTR || dobj == obj){
+ //Make sure this widget is also cleaned up when the base object is deleted
+ this->deleteLater();
+ }
+}
+
+void Panel::updateGeom(){
+ this->setGeometry(obj->geometry());
+ this->setFixedSize(obj->geometry().size());
+ layout->setDirection( obj->isVertical() ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight );
+ for(int i=0; i<PLUGINS.length(); i++){
+ PLUGINS[i]->setVertical( obj->isVertical() );
+ }
+}
+
+void Panel::updateBackground(){
+ static QString PANELTEMPLATE = "QToolButton::menu-indicator{ image: none; } QWidget#LuminaPanelBackgroundWidget{ background: %1; }";
+ QString bg = obj->background();
+ //qDebug() << "Got panel BG:" << obj->name() << bg;
+ this->setStyleSheet(PANELTEMPLATE.arg(bg));
+}
+
+void Panel::updatePlugins(){
+ QStringList plugs = obj->plugins();
+ qDebug() << "Got panel plugins:" << obj->name() << plugs;
+ for(int i=0; i<plugs.length(); i++){
+ lastplugins.removeAll(plugs[i]); //remove this from the last list (handled)
+ Plugin *plug = findPlugin(plugs[i]);
+ if(plug==0){ plug = createPlugin(plugs[i]); }
+ if(plug==0){ continue; } //not a valid plugin - just skip it
+ //Now setup the order of the plugins properly
+ if( layout->indexOf(plug) >=0 ){
+ layout->removeWidget(plug); //remove from the layout for a moment
+ }
+ layout->insertWidget(i, plug);
+ }
+ //Now remove any plugins which were deleted from config
+ for(int i=0; i<lastplugins.length(); i++){
+ Plugin *plug = findPlugin(lastplugins[i]);
+ if(plug==0){ continue; }
+ plug->deleteLater();
+ }
+ lastplugins = plugs;
+}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.h
new file mode 100644
index 00000000..64b0e239
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.h
@@ -0,0 +1,38 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is the Widgets version of a floating, top-level panel
+//===========================================
+#ifndef _DESKTOP_WIDGETS_PANEL_H
+#define _DESKTOP_WIDGETS_PANEL_H
+
+#include <global-includes.h>
+#include <QBoxLayout>
+#include "Plugin.h"
+
+class Panel : public QWidget {
+ Q_OBJECT
+private:
+ PanelObject *obj;
+ QBoxLayout *layout;
+ QStringList lastplugins;
+ //Stuff for managing the plugins
+ QList<Plugin*> PLUGINS;
+ Plugin* findPlugin(QString id);
+ Plugin* createPlugin(QString id);
+
+public:
+ Panel(PanelObject *pobj);
+ ~Panel();
+
+private slots:
+ void objectDestroyed(QObject*);
+ void updateGeom();
+ void updateBackground();
+ void updatePlugins();
+
+};
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
new file mode 100644
index 00000000..0934374f
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
@@ -0,0 +1,58 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is the Widgets version of a generic plugin
+//===========================================
+#ifndef _DESKTOP_WIDGETS_GENERIC_PLUGIN_H
+#define _DESKTOP_WIDGETS_GENERIC_PLUGIN_H
+
+#include <global-includes.h>
+
+//Base plugin type for a canvas/widget
+class Plugin : public QWidget{
+ Q_OBJECT
+private:
+ bool isPanelPlugin;
+ bool isVertical; //only used for panel plugins
+ QString _id;
+
+signals:
+ void orientationChanged();
+
+public:
+ Plugin(QWidget *parent, QString id, bool panelplug = false) : QWidget(parent){
+ isPanelPlugin = panelplug;
+ isVertical = false;
+ _id = id;
+ }
+
+ void setVertical(bool set){
+ if(set!=isVertical){ isVertical = set; emit orientationChanged(); }
+ }
+
+ QString id(){ return _id; }
+
+private slots:
+
+};
+
+//Special subclass for a button-based plugin
+class PluginButton : public Plugin{
+ Q_OBJECT
+private:
+ QToolButton *button;
+
+public:
+ PluginButton(QWidget *parent, QString id, bool panelplug=false) : Plugin(parent, id, panelplug) {
+ button = new QToolButton(this);
+ this->setLayout( new QBoxLayout(QBoxLayout::LeftToRight) );
+ this->layout()->setContentsMargins(0,0,0,0);
+ this->layout()->addWidget(button);
+ }
+
+ ~PluginButton(){}
+};
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.cpp
index 9e22a143..3c034dc6 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.cpp
@@ -6,6 +6,7 @@
//===========================================
#include <global-objects.h>
#include "RootDesktop.h"
+#include "Panel.h"
// === PUBLIC ===
RootDesktop::RootDesktop(QWindow *) : QWidget(0, Qt::Widget | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint){
@@ -66,7 +67,14 @@ void RootDesktop::on_screensChanged(){
}
void RootDesktop::on_panelsChanged(){
-
+ QStringList pans = RootDesktopObject::instance()->panels();
+ //Now find any new panels and create them as needed
+ for(int i=0; i<pans.length(); i++){
+ if(lastpanels.contains(pans[i])){ continue; } //already created
+ //Need to create a new panel widget (self-maintained)
+ new Panel( RootDesktopObject::instance()->panel(pans[i]) );
+ }
+ lastpanels = pans; //save this for the next time around
}
void RootDesktop::on_windowsChanged(){
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.h
index 16ce0e47..ff717074 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/RootDesktop.h
@@ -20,7 +20,7 @@ public:
private:
QImage bgimage;
- QStringList lastscreens;
+ QStringList lastscreens, lastpanels;
QTimer *bgTimer;
DesktopContextMenu *cmenu;
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri
index f1e200fd..7ed228f7 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri
@@ -3,8 +3,11 @@ INCLUDEPATH *= $${PWD}
SOURCES *= $${PWD}/RootDesktop.cpp \
$${PWD}/ContextMenu.cpp \
- $${PWD}/NativeWindow.cpp
+ $${PWD}/NativeWindow.cpp \
+ $${PWD}/Panel.cpp
HEADERS *= $${PWD}/RootDesktop.h \
$${PWD}/ContextMenu.h \
- $${PWD}/NativeWindow.h
+ $${PWD}/NativeWindow.h \
+ $${PWD}/Panel.h \
+ $${PWD}/Plugin.h
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
index 65fa98a7..0d1e9c10 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
@@ -631,6 +631,7 @@ void NativeWindowSystem::SetupNewWindow(NativeWindowObject *win){
win->addDamageID( (uint) dmgID); //save this for later
}else{
+ /*
//xcb_reparent_window(QX11Info::connection(), win->id(), this->winId(), 0, 0);
//Also use a partial-composite here - make sure the window pixmap is available even when the window is obscured
xcb_composite_redirect_window(QX11Info::connection(), win->id(), XCB_COMPOSITE_REDIRECT_AUTOMATIC);
@@ -639,6 +640,7 @@ void NativeWindowSystem::SetupNewWindow(NativeWindowObject *win){
Damage dmgID = XDamageCreate(QX11Info::display(), win->id(), XDamageReportRawRectangles);
win->addDamageID( (uint) dmgID); //save this for later
+ */
}
//win->addFrameWinID(this->winId());
registerClientEvents(win->id());
@@ -795,7 +797,7 @@ void NativeWindowSystem::NewWindowDetected(WId id){
if(attr == 0){ return; } //could not get attributes of window
if(attr->override_redirect){ free(attr); return; } //window has override redirect set (do not manage)
free(attr);
- xcb_reparent_window(QX11Info::connection(), id, QX11Info::appRootWindow(), 0, 0);
+ //xcb_reparent_window(QX11Info::connection(), id, QX11Info::appRootWindow(), 0, 0);
//Now go ahead and create/populate the container for this window
NativeWindowObject *win = new NativeWindowObject(id);
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
index 0b6cd67e..f6033674 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
+++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
@@ -127,12 +127,14 @@ public slots:
void NewMouseRelease(int buttoncode, WId win = 0);
void CheckDamageID(WId);
+ void RequestReparent(WId, WId, QPoint); //client, parent, relative origin point in parent
+
+
private slots:
//These are the slots which are built-in and automatically connected when a new NativeWindow is created
void RequestClose(WId);
void RequestKill(WId);
void RequestPing(WId);
- void RequestReparent(WId, WId, QPoint); //client, parent, relative origin point in parent
//Window-mgmt functions (see Window-mgmt.cpp for details)
void ArrangeWindows(WId primary, QString type);
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");
}
}
diff --git a/src-qt5/core/lumina-session/session.h b/src-qt5/core/lumina-session/session.h
index 3bbcbb8e..6f7f8e36 100644
--- a/src-qt5/core/lumina-session/session.h
+++ b/src-qt5/core/lumina-session/session.h
@@ -63,6 +63,8 @@ private:
int wmfails;
QTimer *wmTimer;
+ void setupCompositor();
+
private slots:
void stopall();
bgstack15