diff --git a/RedPandaIDE/resources/terminal-unix.json b/RedPandaIDE/resources/terminal-unix.json index a7828b20..1dc98a17 100644 --- a/RedPandaIDE/resources/terminal-unix.json +++ b/RedPandaIDE/resources/terminal-unix.json @@ -138,7 +138,7 @@ { "name": "Elementary Terminal", "path": "io.elementary.terminal", - "argsPattern": "$term --gapplication-app-id $random_app_id -e \"$unix_command\"", + "argsPattern": "$term --gapplication-app-id $sequential_app_id -e \"$unix_command\"", "comment": "confirm to quit" }, { @@ -150,7 +150,7 @@ { "name": "GNOME Console", "path": "kgx", - "argsPattern": "$term --gapplication-app-id $random_app_id -- $argv", + "argsPattern": "$term --gapplication-app-id $sequential_app_id -- $argv", "comment": "confirm to quit" }, { diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index d7b9e6a0..566f28c7 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -4134,7 +4134,7 @@ const QMap Settings::Environment::mTerminalArgsPatternMagicVar {"dos_command", "$dos_command"}, {"lpCommandLine", "$lpCommandLine"}, {"tmpfile", "$tmpfile"}, - {"random_app_id", "$random_app_id"}, + {"sequential_app_id", "$sequential_app_id"}, }; Settings::Executor::Executor(Settings *settings):_Base(settings, SETTING_EXECUTOR) diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index 002955b3..d7eb4726 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -754,9 +754,10 @@ std::tuple wrapCommandFor QFile(temproryFile->fileName()).setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner); } wrappedArgs.push_back(temproryFile->fileName()); - } else if (patternItem == "$random_app_id") { - QString randomSuffix = QString::number(QRandomGenerator::global()->generate()); - QString appId = "io.redpanda.term" + randomSuffix; + } else if (patternItem == "$sequential_app_id") { + static QString prefix = QStringLiteral("io.redpanda.term_%1_").arg(QCoreApplication::applicationPid()); + static std::atomic appIdCounter = 0; + QString appId = prefix + QString::number(++appIdCounter); wrappedArgs.push_back(appId); } else wrappedArgs.push_back(patternItem);