diff options
author | Simon Rettberg | 2013-12-13 16:22:05 +0100 |
---|---|---|
committer | Simon Rettberg | 2013-12-13 16:22:05 +0100 |
commit | 75b304546e1bd98bdeb1745c5c849e2ccac11c0f (patch) | |
tree | f4c3f7ebd4c70cc73f66e6d989e99d98b19cdbd2 /src | |
parent | fix problems with unreadable files (diff) | |
download | vmchooser-75b304546e1bd98bdeb1745c5c849e2ccac11c0f.tar.gz vmchooser-75b304546e1bd98bdeb1745c5c849e2ccac11c0f.tar.xz vmchooser-75b304546e1bd98bdeb1745c5c849e2ccac11c0f.zip |
Add support for a session start script that gets run right before the session is started
Diffstat (limited to 'src')
-rw-r--r-- | src/dialog.cpp | 9 | ||||
-rw-r--r-- | src/globals.cpp | 1 | ||||
-rw-r--r-- | src/globals.h | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp index 342da87..21c5620 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -4,6 +4,7 @@ #include <QDebug> #include <QRegExp> #include <QFile> +#include <QProcess> #include "ui_dialog.h" #include "save_restore_session.h" @@ -46,6 +47,14 @@ void Dialog::on_treeView_activated(QModelIndex index) { // no valid session has been selected, do nothing return; } + + // Run session start script + if (QFile::exists(sessionStartScript)) { + QProcess scriptProcess; + scriptProcess.start(sessionStartScript, QIODevice::ReadOnly); + scriptProcess.waitForFinished(); + scriptProcess.close(); + } if (s->run()) { writePVSSettings(); diff --git a/src/globals.cpp b/src/globals.cpp index 31e54d5..8026752 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -13,6 +13,7 @@ QString runVmScript(binPath + "/run-virt.sh"); QString filterScript(binPath + "/xmlfilter.sh"); QString printerScript(etcPath + "/printer.sh"); QString scannerScript(etcPath + "/scanner.sh"); +QString sessionStartScript(VMCHOOSER_SESSION_START_SCRIPT); const QString globalConfFile(etcPath + "/vmchooser.conf"); const QString userConfFile(userPath + "/vmchooser.conf"); diff --git a/src/globals.h b/src/globals.h index d46db63..f32fc64 100644 --- a/src/globals.h +++ b/src/globals.h @@ -11,6 +11,8 @@ #define VMCHOOSER_X_SESSIONS_PATH "/usr/share/xsessions" +#define VMCHOOSER_SESSION_START_SCRIPT "/opt/openslx/vmchooser/sessionstart" + #define VMCHOOSER_DEFAULT_WIDTH 500 #define VMCHOOSER_DEFAULT_HEIGHT 580 @@ -29,6 +31,8 @@ extern QString runVmScript; extern QString filterScript; extern QString printerScript; extern QString scannerScript; +// Script that is run before the xsession/vsession is started +extern QString sessionStartScript; extern const QString globalConfFile; extern const QString userConfFile; |