From 6c19e733673e24684707836fb2c9e0f45d1ac3f9 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Tue, 11 Oct 2022 21:21:09 +0200 Subject: Fix Wayland window activation when attaching to an existing instance The application launching Dolphin passes a token via the XDG_ACTIVATION_TOKEN environment variable We need to pass that to the running instance so that it can use it to raise itself --- src/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 017a31f1d..9da0c6fe8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include @@ -175,7 +176,14 @@ int main(int argc, char **argv) } if (!parser.isSet(QStringLiteral("new-window"))) { - if (Dolphin::attachToExistingInstance(urls, openFiles, splitView)) { + + QString token; + if (KWindowSystem::isPlatformWayland()) { + token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN"); + qunsetenv("XDG_ACTIVATION_TOKEN"); + } + + if (Dolphin::attachToExistingInstance(urls, openFiles, splitView, QString(), token)) { // Successfully attached to existing instance of Dolphin return 0; } -- cgit v1.3