diff options
author | Jannik Schönartz | 2021-09-13 14:14:03 +0200 |
---|---|---|
committer | Jannik Schönartz | 2021-09-13 14:14:03 +0200 |
commit | aabb6ce2cfd615338503a0800da9502bd9453d2e (patch) | |
tree | 3251d23d82e387c6267c49a2bf96527e670b2b54 | |
parent | Add icon for QEMU virtualizer (diff) | |
download | vmchooser2-autostart-lecture.tar.gz vmchooser2-autostart-lecture.tar.xz vmchooser2-autostart-lecture.zip |
Autostart a lecture if the SLX_AUTOSTART_UUID file exists in config_overrideautostart-lecture
-rw-r--r-- | src/main.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index df7309c..65cc14c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,6 +9,11 @@ #include <QtDebug> #include <QMessageBox> +#include <QFile> +#include <QFileInfo> +#include <QIODevice> +#include <QStandardPaths> + #include <cstdlib> #include <iostream> #include <string> @@ -123,13 +128,19 @@ int main(int argc, char *argv[]) { w.show(); - if (Config::isSet(Config::AUTOSTART_UUID)) { + // First check if theres an override file for the SLX_AUTOSTART_UUID + QString fileName("/var/lib/lightdm/config_overrides/SLX_AUTOSTART_UUID"); + QFile file(fileName); + if (QFileInfo::exists(fileName)) { + file.open(QIODevice::ReadOnly); + QString data = file.readAll(); + qDebug() << "using startSession() from main.cpp (autostart uuid from override file)"; + w.startSession(data.simplified()); + } else if (Config::isSet(Config::AUTOSTART_UUID)) { qDebug() << "using startSession() from main.cpp"; w.startSession(Config::get(Config::AUTOSTART_UUID)); } - - // center dialog on primary screen QPoint center = desktopRect.center(); w.move(center.x() - w.width() / 2, center.y() - w.height() / 2); |