summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/notifications/Manager.h1
-rw-r--r--src/notifications/ManagerLinux.cpp15
-rw-r--r--src/notifications/ManagerMac.mm2
-rw-r--r--src/notifications/ManagerWin.cpp4
4 files changed, 22 insertions, 0 deletions
diff --git a/src/notifications/Manager.h b/src/notifications/Manager.h
index 7686d78e..fbebfcba 100644
--- a/src/notifications/Manager.h
+++ b/src/notifications/Manager.h
@@ -101,6 +101,7 @@ private:
     // but Qt slot declarations can not be inside an ifdef!
 private slots:
     void actionInvoked(uint id, QString action);
+    void activationToken(uint id, QString action);
     void notificationClosed(uint id, uint reason);
     void notificationReplied(uint id, QString reply);
 
diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp
index e838bb85..b181fdc3 100644
--- a/src/notifications/ManagerLinux.cpp
+++ b/src/notifications/ManagerLinux.cpp
@@ -22,6 +22,7 @@
 
 #include "Cache.h"
 #include "EventAccessors.h"
+#include "Logging.h"
 #include "MxcImageProvider.h"
 #include "UserSettingsPage.h"
 #include "Utils.h"
@@ -61,6 +62,12 @@ NotificationsManager::NotificationsManager(QObject *parent)
     QDBusConnection::sessionBus().connect(QStringLiteral("org.freedesktop.Notifications"),
                                           QStringLiteral("/org/freedesktop/Notifications"),
                                           QStringLiteral("org.freedesktop.Notifications"),
+                                          QStringLiteral("ActivationToken"),
+                                          this,
+                                          SLOT(activationToken(uint,QString)));
+    QDBusConnection::sessionBus().connect(QStringLiteral("org.freedesktop.Notifications"),
+                                          QStringLiteral("/org/freedesktop/Notifications"),
+                                          QStringLiteral("org.freedesktop.Notifications"),
                                           QStringLiteral("NotificationClosed"),
                                           this,
                                           SLOT(notificationClosed(uint,uint)));
@@ -256,6 +263,14 @@ NotificationsManager::actionInvoked(uint id, QString action)
     }
 }
 
+// receive a wayland activation token from the notification manager
+void
+NotificationsManager::activationToken(uint, QString action)
+{
+    nhlog::net()->debug("Got activation token for notification");
+    qputenv("XDG_ACTIVATION_TOKEN", action.toUtf8());
+}
+
 void
 NotificationsManager::notificationReplied(uint id, QString reply)
 {
diff --git a/src/notifications/ManagerMac.mm b/src/notifications/ManagerMac.mm
index 69914ac6..06e6e55e 100644
--- a/src/notifications/ManagerMac.mm
+++ b/src/notifications/ManagerMac.mm
@@ -182,6 +182,8 @@ void NotificationsManager::attachToMacNotifCenter()
 // unused
 void NotificationsManager::actionInvoked(uint, QString) { }
 
+void NotificationsManager::activationToken(uint, QString) { }
+
 void NotificationsManager::notificationReplied(uint, QString) { }
 
 void NotificationsManager::notificationClosed(uint, uint) { }
diff --git a/src/notifications/ManagerWin.cpp b/src/notifications/ManagerWin.cpp
index ce0143b0..8d200abc 100644
--- a/src/notifications/ManagerWin.cpp
+++ b/src/notifications/ManagerWin.cpp
@@ -96,6 +96,10 @@ NotificationsManager::actionInvoked(uint, QString)
 {}
 
 void
+NotificationsManager::activationToken(uint, QString)
+{}
+
+void
 NotificationsManager::notificationReplied(uint, QString)
 {}