X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/19cd2364a917c55e245dbdf3bfc87b2dc520046c..6d21deb6e48627922fb223a4281ade46d6d230ec:/src/main.cpp diff --git a/src/main.cpp b/src/main.cpp index 89720fb65..a9b85dbcc 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 @@ -31,11 +32,17 @@ #include #include #include -#include -#include #include #include +#if HAVE_X11 +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +#else +#include +#endif +#endif + #ifndef Q_OS_WIN #include #endif @@ -143,7 +150,7 @@ int main(int argc, char **argv) "will be selected."))); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("split"), i18nc("@info:shell", "Dolphin will get started with a split view."))); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("new-window"), i18nc("@info:shell", "Dolphin will explicitly open in a new window."))); - parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("daemon"), i18nc("@info:shell", "Start Dolphin Daemon (only required for DBus Interface)"))); + parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("daemon"), i18nc("@info:shell", "Start Dolphin Daemon (only required for DBus Interface)."))); parser.addPositionalArgument(QStringLiteral("+[Url]"), i18nc("@info:shell", "Document to open")); parser.process(app); @@ -177,7 +184,18 @@ 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"); + } else if (KWindowSystem::isPlatformX11()) { +#if HAVE_X11 + token = QX11Info::nextStartupId(); +#endif + } + + if (Dolphin::attachToExistingInstance(urls, openFiles, splitView, QString(), token)) { // Successfully attached to existing instance of Dolphin return 0; }