]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DBus activation with filemanager iface
authorAndrey Butirsky <butirsky@gmail.com>
Fri, 20 Aug 2021 09:31:36 +0000 (12:31 +0300)
committerAndrey Butirsky <butirsky@gmail.com>
Wed, 25 Aug 2021 14:45:55 +0000 (14:45 +0000)
In Dolphin on wayland currently, if you right clicks a file and create a
zip file from it, Dolphin makes a new window.
What we want to happen is Dolphin to focus the window we have with the
file selected.

This patches Dolphin's dbusinterface.cpp to call
KWindowSystem::setCurrentXdgActivationToken()
with the startupID

src/dbusinterface.cpp
src/global.cpp

index 2b674b96888382b5497e0fd639c8c9fd6f7a0788..e4f647f737ea0d9ca7e7fcbb5d06eb20e1f86e55 100644 (file)
@@ -9,6 +9,7 @@
 #include "dolphin_generalsettings.h"
 
 #include <KPropertiesDialog>
+#include <KWindowSystem>
 
 #include <QApplication>
 #include <QDBusConnection>
@@ -28,11 +29,11 @@ DBusInterface::DBusInterface() :
 
 void DBusInterface::ShowFolders(const QStringList& uriList, const QString& startUpId)
 {
-    Q_UNUSED(startUpId)
     const QList<QUrl> urls = Dolphin::validateUris(uriList);
     if (urls.isEmpty()) {
         return;
     }
+    KWindowSystem::setCurrentXdgActivationToken(startUpId);
     const auto serviceName = isDaemon() ? QString() : QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid());
     if(!Dolphin::attachToExistingInstance(urls, false, GeneralSettings::splitView(), serviceName)) {
         Dolphin::openNewWindow(urls);
@@ -41,11 +42,11 @@ void DBusInterface::ShowFolders(const QStringList& uriList, const QString& start
 
 void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUpId)
 {
-    Q_UNUSED(startUpId)
     const QList<QUrl> urls = Dolphin::validateUris(uriList);
     if (urls.isEmpty()) {
         return;
     }
+    KWindowSystem::setCurrentXdgActivationToken(startUpId);
     const auto serviceName = isDaemon() ? QString() : QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid());
     if(!Dolphin::attachToExistingInstance(urls, true, GeneralSettings::splitView(), serviceName)) {
         Dolphin::openNewWindow(urls, nullptr, Dolphin::OpenNewWindowFlag::Select);
@@ -54,9 +55,9 @@ void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUp
 
 void DBusInterface::ShowItemProperties(const QStringList& uriList, const QString& startUpId)
 {
-    Q_UNUSED(startUpId)
     const QList<QUrl> urls = Dolphin::validateUris(uriList);
     if (!urls.isEmpty()) {
+        KWindowSystem::setCurrentXdgActivationToken(startUpId);
         KPropertiesDialog::showDialog(urls);
     }
 }
index d217a67ec82c71996d90b2f2b01636a88189380d..e81b7d34d5f72858009c16eb2f71f4f1c63fd01c 100644 (file)
@@ -62,8 +62,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
 {
     bool attached = false;
 
-    // TODO: once Wayland clients can raise or activate themselves remove check from conditional
-    if (KWindowSystem::isPlatformWayland() || inputUrls.isEmpty() || !GeneralSettings::openExternallyCalledFolderInNewTab()) {
+    if (inputUrls.isEmpty() || !GeneralSettings::openExternallyCalledFolderInNewTab()) {
         return false;
     }