┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorNicolas Fella <[email protected]>2022-10-11 21:21:09 +0200
committerNicolas Fella <[email protected]>2022-10-14 14:46:29 +0000
commit6c19e733673e24684707836fb2c9e0f45d1ac3f9 (patch)
treef95d905c3e17a2d5e3acb55b9312d925506b77e2 /src/main.cpp
parent354aba3c85c686bee8027e3ff84d1684c9a6c840 (diff)
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
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp10
1 files changed, 9 insertions, 1 deletions
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 <KLocalizedString>
#include <KConfigGui>
#include <KIO/PreviewJob>
+#include <KWindowSystem>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <Kdelibs4ConfigMigrator>
@@ -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;
}