From 2b88432b17ec9b0eaff4e605359a6c554123ddeb Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 19 Aug 2021 10:09:24 +0100 Subject: [PATCH] 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. --- src/main_wayland.cpp | 1 + src/xwl/xwayland.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index 5a5ca2e532..147a84457f 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -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); diff --git a/src/xwl/xwayland.cpp b/src/xwl/xwayland.cpp index 22261b5050..a406397d32 100644 --- a/src/xwl/xwayland.cpp +++ b/src/xwl/xwayland.cpp @@ -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