Export our nested environment to kwin's env

In the recent refactor we made it so environment variables got synced to
the Application::processStartupEnvironment.

It then seemed safe and cleaner to remove the qputenv calls, but this
was not the case. It regressed the unit tests on CI and kglobalaccel
which is another path where kwin spawns clients.
This commit is contained in:
David Edmundson 2021-08-19 10:09:24 +01:00
parent 6104dc50cf
commit 2b88432b17
2 changed files with 3 additions and 0 deletions

View file

@ -717,6 +717,7 @@ int main(int argc, char * argv[])
QObject::connect(&a, &KWin::Application::workspaceCreated, server, &KWin::WaylandServer::initWorkspace);
if (!server->socketName().isEmpty()) {
environment.insert(QStringLiteral("WAYLAND_DISPLAY"), server->socketName());
qputenv("WAYLAND_DISPLAY", server->socketName().toUtf8());
}
a.setProcessStartupEnvironment(environment);

View file

@ -388,6 +388,8 @@ void Xwayland::handleXwaylandReady()
auto env = m_app->processStartupEnvironment();
env.insert(QStringLiteral("DISPLAY"), m_displayName);
env.insert(QStringLiteral("XAUTHORITY"), m_xAuthority);
qputenv("DISPLAY", m_displayName.toUtf8());
qputenv("XAUTHORITY", m_xAuthority.toUtf8());
m_app->setProcessStartupEnvironment(env);
Xcb::sync(); // Trigger possible errors, there's still a chance to abort