use pid + sequential number in terminal app id (#448)
This commit is contained in:
parent
26a2f44006
commit
d7df8248ab
|
@ -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"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -4134,7 +4134,7 @@ const QMap<QString, QString> 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)
|
||||
|
|
|
@ -754,9 +754,10 @@ std::tuple<QString, QStringList, PNonExclusiveTemporaryFileOwner> 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<int> appIdCounter = 0;
|
||||
QString appId = prefix + QString::number(++appIdCounter);
|
||||
wrappedArgs.push_back(appId);
|
||||
} else
|
||||
wrappedArgs.push_back(patternItem);
|
||||
|
|
Loading…
Reference in New Issue