From 75b304546e1bd98bdeb1745c5c849e2ccac11c0f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 13 Dec 2013 16:22:05 +0100 Subject: Add support for a session start script that gets run right before the session is started --- src/dialog.cpp | 9 +++++++++ src/globals.cpp | 1 + src/globals.h | 4 ++++ 3 files changed, 14 insertions(+) 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 #include #include +#include #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; -- cgit v1.2.3-55-g7522