diff options
| author | Nicolas Fella <[email protected]> | 2022-12-15 00:56:11 +0100 |
|---|---|---|
| committer | Nicolas Fella <[email protected]> | 2022-12-30 12:33:01 +0000 |
| commit | 6d21deb6e48627922fb223a4281ade46d6d230ec (patch) | |
| tree | 73f35fb0c7c73d71598224e20fd0683070a399c0 /src/main.cpp | |
| parent | 414311b8c8c2ba7b9adb42e495368039bd33b5ad (diff) | |
Properly use X11 startup ids
When one instance of Dolphin activates another it passes a startupId (X11) / activation token (wayland) along.
On X11 this is passed using the DESKTOP_STARTUP_ID environment variable. The code tries to read that through KStartupInfo::startupId().
That doesn't work though, since Qt at startup reads the environment variable afterwards. However, it is nice enough to allow us to access
it through QX11Info::nextStartupId(). Use that to read the token in the first instance and pass it to the second instance like we do on Wayland
The user-facing impact of this is minimal since KStartupInfo::setNewStartupId internally falls back to KWindowSystem::forceActiveWindow when no
startupId is passed.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index a45083e40..a9b85dbcc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,6 +35,14 @@ #include <QDBusConnectionInterface> #include <QSessionManager> +#if HAVE_X11 +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include <private/qtx11extras_p.h> +#else +#include <QX11Info> +#endif +#endif + #ifndef Q_OS_WIN #include <unistd.h> #endif @@ -181,6 +189,10 @@ int main(int argc, char **argv) if (KWindowSystem::isPlatformWayland()) { token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN"); qunsetenv("XDG_ACTIVATION_TOKEN"); + } else if (KWindowSystem::isPlatformX11()) { +#if HAVE_X11 + token = QX11Info::nextStartupId(); +#endif } if (Dolphin::attachToExistingInstance(urls, openFiles, splitView, QString(), token)) { |
