]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/main.cpp
Properly use X11 startup ids
[dolphin.git] / src / main.cpp
index 9da0c6fe81d5381dc70a67e19a0bc688399802af..a9b85dbcc8971ea82fc292a67ba8ea5e44f87c2a 100644 (file)
 #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
@@ -142,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);
@@ -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)) {