summary refs log tree commit diff
path: root/src/notifications/ManagerLinux.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-11-20 13:59:20 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-11-20 14:05:03 +0100
commitb16b52b40b48ebb4f2f388248d50f3d35900a3ce (patch)
tree77f943eb7ee9e51d615421b80aaf13923b6e7367 /src/notifications/ManagerLinux.cpp
parentSupport window activation on wayland (diff)
downloadnheko-b16b52b40b48ebb4f2f388248d50f3d35900a3ce.tar.xz
Support activation tokens for notifications
Diffstat (limited to 'src/notifications/ManagerLinux.cpp')
-rw-r--r--src/notifications/ManagerLinux.cpp15
1 files changed, 15 insertions, 0 deletions
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)
 {