diff options
| author | Nicolas Fella <[email protected]> | 2022-10-11 21:21:09 +0200 |
|---|---|---|
| committer | Nicolas Fella <[email protected]> | 2022-10-14 14:46:29 +0000 |
| commit | 6c19e733673e24684707836fb2c9e0f45d1ac3f9 (patch) | |
| tree | f95d905c3e17a2d5e3acb55b9312d925506b77e2 /src/dolphinmainwindow.cpp | |
| parent | 354aba3c85c686bee8027e3ff84d1684c9a6c840 (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/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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() |
