diff options
author | Ken Moore <moorekou@gmail.com> | 2016-07-06 12:51:07 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-07-06 12:51:07 -0400 |
commit | 5b5a8cb0532d5c031b26ab6d115850fd1160fd03 (patch) | |
tree | b58cfd365016cf15cdf3f319daba64b50c29f6f1 /src-qt5/core/lumina-session/session.h | |
parent | Merge branch 'master' of github.com:trueos/lumina (diff) | |
download | lumina-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.
Diffstat (limited to 'src-qt5/core/lumina-session/session.h')
-rw-r--r-- | src-qt5/core/lumina-session/session.h | 41 |
1 files changed, 40 insertions, 1 deletions
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(){ |