[wayland] Introduce an additional --exit-with-session command line arg
This is similar to the applications to start. That is the value of the command line argument is interpreted as a command to start. The difference is that when this application exits, KWin will also quit. The argument is so to say interpreted as a session. Reviewed-By: Bhushan Shah
This commit is contained in:
parent
eabddf939b
commit
23784d2038
2 changed files with 21 additions and 0 deletions
|
@ -214,6 +214,14 @@ void ApplicationWayland::continueStartupWithX()
|
|||
}
|
||||
|
||||
m_environment.insert(QStringLiteral("DISPLAY"), QString::fromUtf8(qgetenv("DISPLAY")));
|
||||
// start session
|
||||
if (!m_sessionArgument.isEmpty()) {
|
||||
QProcess *p = new QProcess(this);
|
||||
p->setProcessEnvironment(m_environment);
|
||||
auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished);
|
||||
connect(p, finishedSignal, this, &ApplicationWayland::quit);
|
||||
p->start(m_sessionArgument);
|
||||
}
|
||||
// start the applications passed to us as command line arguments
|
||||
if (!m_applicationsToStart.isEmpty()) {
|
||||
for (const QString &application: m_applicationsToStart) {
|
||||
|
@ -513,6 +521,11 @@ int main(int argc, char * argv[])
|
|||
i18n("Starts the session in locked mode."));
|
||||
parser.addOption(screenLockerOption);
|
||||
|
||||
QCommandLineOption exitWithSessionOption(QStringLiteral("exit-with-session"),
|
||||
i18n("Exit after the session application, which is started by KWin, closed."),
|
||||
QStringLiteral("/path/to/session"));
|
||||
parser.addOption(exitWithSessionOption);
|
||||
|
||||
parser.addPositionalArgument(QStringLiteral("applications"),
|
||||
i18n("Applications to start once Wayland and Xwayland server are started"),
|
||||
QStringLiteral("[/path/to/application...]"));
|
||||
|
@ -527,6 +540,10 @@ int main(int argc, char * argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (parser.isSet(exitWithSessionOption)) {
|
||||
a.setSessionArgument(parser.value(exitWithSessionOption));
|
||||
}
|
||||
|
||||
#if HAVE_INPUT
|
||||
KWin::Application::setUseLibinput(parser.isSet(libinputOption));
|
||||
#endif
|
||||
|
|
|
@ -46,6 +46,9 @@ public:
|
|||
void setProcessStartupEnvironment(const QProcessEnvironment &environment) {
|
||||
m_environment = environment;
|
||||
}
|
||||
void setSessionArgument(const QString &session) {
|
||||
m_sessionArgument = session;
|
||||
}
|
||||
|
||||
QProcessEnvironment processStartupEnvironment() const override {
|
||||
return m_environment;
|
||||
|
@ -68,6 +71,7 @@ private:
|
|||
QProcess *m_xwaylandProcess = nullptr;
|
||||
QMetaObject::Connection m_xwaylandFailConnection;
|
||||
QProcessEnvironment m_environment;
|
||||
QString m_sessionArgument;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue