diff options
author | Jonathan Bauer | 2016-01-26 15:18:50 +0100 |
---|---|---|
committer | Jonathan Bauer | 2016-01-26 15:18:50 +0100 |
commit | 08ca25dbb84a936df5c597a45fd08b98bb942a98 (patch) | |
tree | 6003cb1ea23fef496e7af3caee26b1647f1a2e19 /src | |
parent | Scroll the item into view when selecting programatically (diff) | |
download | vmchooser2-08ca25dbb84a936df5c597a45fd08b98bb942a98.tar.gz vmchooser2-08ca25dbb84a936df5c597a45fd08b98bb942a98.tar.xz vmchooser2-08ca25dbb84a936df5c597a45fd08b98bb942a98.zip |
reworked session information sent to the session process
exports the Exec= command as SESSION_CMD
exports the type of the session (virtual/native) as SESSION_TYPE
Diffstat (limited to 'src')
-rw-r--r-- | src/dialog.cpp | 10 | ||||
-rw-r--r-- | src/session.h | 1 | ||||
-rw-r--r-- | src/vsession.h | 4 | ||||
-rw-r--r-- | src/xsession.h | 4 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp index 17fc474..9cb5aeb 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -111,8 +111,14 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index) setenv("PVS_AUTO_CONNECT", "TRUE", 1); else setenv("PVS_AUTO_CONNECT", "FALSE", 1); - setenv("SESSION_NAME", s->shortDescription().toUtf8(), 1); - + // export session information to the environment of the process to be exec'ed + if (s->type() == Session::VSESSION) { + setenv("SESSION_TYPE", "VSESSION", 1); + setenv("SESSION_CMD", "", 1); + } else if (s->type() == Session::XSESSION) { + setenv("SESSION_TYPE", "XSESSION", 1); + setenv("SESSION_CMD", s->execCommand() != NULL ? s->execCommand().toUtf8() : "", 1); + } // Fork this process twice to detach pid_t pid = fork(); if (pid == 0) { diff --git a/src/session.h b/src/session.h index d88e766..4a9699f 100644 --- a/src/session.h +++ b/src/session.h @@ -24,6 +24,7 @@ class Session { virtual QString description() const = 0; virtual QIcon icon() const = 0; virtual bool run() const = 0; + virtual QString execCommand() const = 0; virtual int type() const = 0; virtual SectionType section() const = 0; diff --git a/src/vsession.h b/src/vsession.h index 49bde75..dab0fd8 100644 --- a/src/vsession.h +++ b/src/vsession.h @@ -40,7 +40,9 @@ class VSession : public Session { QString description() const { return getAttribute("long_description"); } - + QString execCommand() const { + return NULL; + } QIcon icon() const; QString os() const { diff --git a/src/xsession.h b/src/xsession.h index 5f78bff..87283c9 100644 --- a/src/xsession.h +++ b/src/xsession.h @@ -30,7 +30,9 @@ class XSession : public Session { QString description() const { return this->comment_; } - + QString execCommand() const { + return this->exec_; + } QIcon icon() const; bool run() const; |