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/dolphinmainwindow.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 305c7f282..384e91ec9 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -281,11 +281,17 @@ void DolphinMainWindow::openFiles(const QStringList& files, bool splitView) openFiles(QUrl::fromStringList(files), splitView); } -void DolphinMainWindow::activateWindow() +void DolphinMainWindow::activateWindow(const QString &activationToken) { window()->setAttribute(Qt::WA_NativeWindow, true); - KStartupInfo::setNewStartupId(window()->windowHandle(), KStartupInfo::startupId()); - KWindowSystem::activateWindow(window()->effectiveWinId()); + + if (KWindowSystem::isPlatformWayland()) { + KWindowSystem::setCurrentXdgActivationToken(activationToken); + } else { + KStartupInfo::setNewStartupId(window()->windowHandle(), KStartupInfo::startupId()); + } + + KWindowSystem::activateWindow(window()->windowHandle()); } bool DolphinMainWindow::isActiveWindow() -- cgit v1.3