aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-07-06 12:51:07 -0400
committerKen Moore <moorekou@gmail.com>2016-07-06 12:51:07 -0400
commit5b5a8cb0532d5c031b26ab6d115850fd1160fd03 (patch)
treeb58cfd365016cf15cdf3f319daba64b50c29f6f1
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-5b5a8cb0532d5c031b26ab6d115850fd1160fd03.tar.gz
lumina-5b5a8cb0532d5c031b26ab6d115850fd1160fd03.tar.bz2
lumina-5b5a8cb0532d5c031b26ab6d115850fd1160fd03.zip
Setup the session process launcher to provide the capability of prompting fluxbox and/or compton to reload it's configs when they change.
-rw-r--r--src-qt5/core/lumina-session/lumina-session.pro4
-rw-r--r--src-qt5/core/lumina-session/session.cpp8
-rw-r--r--src-qt5/core/lumina-session/session.h41
3 files changed, 46 insertions, 7 deletions
diff --git a/src-qt5/core/lumina-session/lumina-session.pro b/src-qt5/core/lumina-session/lumina-session.pro
index 91ef5ed0..91a5f891 100644
--- a/src-qt5/core/lumina-session/lumina-session.pro
+++ b/src-qt5/core/lumina-session/lumina-session.pro
@@ -1,13 +1,13 @@
include($${PWD}/../../OS-detect.pri)
-QT += core widgets x11extras
+QT = core widgets
TARGET = start-lumina-desktop
target.path = $${L_BINDIR}
-LIBS += -lLuminaUtils -lxcb -lxcb-damage
+LIBS += -lLuminaUtils
DEPENDPATH += ../libLumina
SOURCES += main.cpp \
diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp
index 7f9983dd..384c75f9 100644
--- a/src-qt5/core/lumina-session/session.cpp
+++ b/src-qt5/core/lumina-session/session.cpp
@@ -44,14 +44,14 @@ void LSession::procFinished(){
}
}
-void LSession::startProcess(QString ID, QString command){
+void LSession::startProcess(QString ID, QString command, QStringList watchfiles){
QString dir = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/logs";
if(!QFile::exists(dir)){ QDir tmp(dir); tmp.mkpath(dir); }
QString logfile = dir+"/"+ID+".log";
if(QFile::exists(logfile+".old")){ QFile::remove(logfile+".old"); }
if(QFile::exists(logfile)){ QFile::rename(logfile,logfile+".old"); }
- QProcess *proc = new QProcess();
+ LProcess *proc = new LProcess(ID, watchfiles);
proc->setProcessChannelMode(QProcess::MergedChannels);
proc->setProcessEnvironment( QProcessEnvironment::systemEnvironment() );
proc->setStandardOutputFile(logfile);
@@ -68,7 +68,7 @@ void LSession::start(){
//Window Manager First
// FLUXBOX BUG BYPASS: if the ~/.fluxbox dir does not exist, it will ignore the given config file
//if(!QFile::exists(QDir::homePath()+"/.fluxbox")){ QDir dir; dir.mkpath(QDir::homePath()+"/.fluxbox"); }
- //startProcess("wm", "fluxbox -rc "+QDir::homePath()+"/.lumina/fluxbox-init -no-slit -no-toolbar");
+ //startProcess("wm", "fluxbox -rc "+QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init -no-slit -no-toolbar");
//Compositing manager
if(LUtils::isValidBinary("compton")){
@@ -84,7 +84,7 @@ void LSession::start(){
qDebug() << "Using default compton settings";
startProcess("compositing","compton");
}else{
- startProcess("compositing","compton --config \""+set+"\"");
+ startProcess("compositing","compton --config \""+set+"\"", QStringList() << set);
}
}else if(LUtils::isValidBinary("xcompmgr")){ startProcess("compositing","xcompmgr"); }
diff --git a/src-qt5/core/lumina-session/session.h b/src-qt5/core/lumina-session/session.h
index 5bd5d44a..0bace416 100644
--- a/src-qt5/core/lumina-session/session.h
+++ b/src-qt5/core/lumina-session/session.h
@@ -6,6 +6,45 @@
//===========================================
#include <QObject>
#include <QProcess>
+#include <QFileSystemWatcher>
+
+#include <sys/types.h>
+#include <signal.h>
+
+class LProcess : public QProcess{
+ Q_OBJECT
+private:
+ QFileSystemWatcher *watcher;
+ QString id;
+private slots:
+ void filechanged(QString path){
+ if(watcher==0){ return; } //just in case
+ if(this->state()==QProcess::Running){
+ if(this->program().section(" ",0,0).section("/",-1) == "fluxbox" ){ ::kill(this->pid(), SIGUSR2); } //Fluxbox needs SIGUSR2 to reload it's configs
+ else if(this->program().section(" ",0,0).section("/",-1) == "compton" ){ ::kill(this->pid(), SIGUSR1); } //Compton needs SIGUSR1 to reload it's configs
+ }
+ //Now make sure this file/dir was not removed from the watcher
+ QStringList watched; watched << watcher->files() << watcher->directories();
+ if(!watched.contains(path)){ watcher->addPath(path); } //re-add it
+ }
+
+public:
+ LProcess(QString ID, QStringList watchfiles) : QProcess(){
+ id=ID;
+ watcher = 0;
+ if(watchfiles.isEmpty()){
+ watcher = new QFileSystemWatcher(this);
+ connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(filechanged(QString)) );
+ connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(filechanged(QString)) );
+ watcher->addPaths(watchfiles);
+ }
+ }
+ ~LProcess(){
+
+ }
+ QString ID(){ return id; }
+
+};
class LSession : public QObject{
Q_OBJECT
@@ -18,7 +57,7 @@ private slots:
void procFinished();
- void startProcess(QString ID, QString command);
+ void startProcess(QString ID, QString command, QStringList watchfiles = QStringList());
public:
LSession(){
bgstack15