diff --git a/generaldialog.cpp b/generaldialog.cpp index ec1b5b8..6738a25 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -211,7 +211,7 @@ generalDialog::generalDialog(QWidget *parent) : } else { // We shouldn't be there ;) - log("generalDialog launched without settings", className); + log("Launched without settings", className); } // Centering dialog diff --git a/main.cpp b/main.cpp index 2d1bd54..7802553 100644 --- a/main.cpp +++ b/main.cpp @@ -38,6 +38,9 @@ int main(int argc, char *argv[]) global::deviceID = readFile("/opt/inkbox_device"); log("Running on device " + global::deviceID, "main", true); + // Tell the OS that we're currently running + string_writeconfig("/tmp/inkbox_running", "true"); + setDefaultWorkDir(); if(checkconfig("/run/wifi_able") == true) { log("Device has Wi-Fi capabilities", "main"); @@ -51,6 +54,23 @@ int main(int argc, char *argv[]) if(QFile::exists("/tmp/rescan_userapps")) { QFile::remove("/tmp/rescan_userapps"); log("Re-scanning user applications from explicit request", "main"); + string_writeconfig("/opt/ibxd", "gui_apps_stop\n"); + QThread::msleep(1000); + string_writeconfig("/opt/ibxd", "gui_apps_start\n"); + while(true) { + if(QFile::exists("/tmp/gui_apps_started")) { + if(checkconfig("/tmp/gui_apps_started") == true) { + QFile::remove("/tmp/gui_apps_started"); + updateUserAppsMainJsonFile(); + break; + } + else { + log("GUI apps service failed to start", "main"); + QFile::remove("/tmp/gui_apps_started"); + break; + } + } + } updateUserAppsMainJsonFile(); } @@ -73,9 +93,6 @@ int main(int argc, char *argv[]) return a.exec(); } else { - // Tell scripts that we're currently running - string_writeconfig("/tmp/inkbox_running", "true"); - // Variables global::reader::startBatteryWatchdog = false; global::reader::startUsbmsPrompt = false; diff --git a/userapps.cpp b/userapps.cpp index 3640a98..db82e46 100644 --- a/userapps.cpp +++ b/userapps.cpp @@ -161,6 +161,8 @@ void userapps::on_launchBtn_clicked() QString message = "Launching user application at: "; message.append(appDir.path() + execPath.fileName()); log(message, className); + // Tell the OS that we're not running anymore + string_writeconfig("/tmp/inkbox_running", "false"); QProcess process; QStringList args;