From 496c361bdc796fe9837524c87b26077c47a11914 Mon Sep 17 00:00:00 2001 From: Kirill Romanov Date: Thu, 8 Nov 2018 13:58:04 +0300 Subject: [PATCH] Gnome notification fix (#5215) * Set notification desktop entry hint * Set X-GNOME-UsesNotifications flag --- .../SourceFiles/platform/linux/notifications_manager_linux.cpp | 3 +++ Telegram/SourceFiles/platform/linux/specific_linux.cpp | 1 + lib/xdg/telegramdesktop.desktop | 1 + 3 files changed, 5 insertions(+) diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 18c07d32a9..6ed7f15e87 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -111,6 +111,7 @@ public: bool show() { if (valid()) { GError *error = nullptr; + Libs::notify_notification_show(_data, &error); if (!error) { return true; @@ -152,6 +153,8 @@ private: Libs::notify_notification_set_hint_string(_data, "x-canonical-append", "true"); } + Libs::notify_notification_set_hint_string(_data, "desktop-entry", "telegramdesktop"); + auto signalReceiver = Libs::g_object_cast(_data); auto signalHandler = G_CALLBACK(NotificationData::notificationClosed); auto signalName = "closed"; diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 2948e49807..710f370161 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -383,6 +383,7 @@ void RegisterCustomScheme() { s << "Categories=Network;InstantMessaging;Qt;\n"; s << "MimeType=x-scheme-handler/tg;\n"; s << "Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;\n"; + s << "X-GNOME-UsesNotifications=true\n"; f.close(); if (_psRunCommand("desktop-file-install --dir=" + EscapeShell(QFile::encodeName(home + qsl(".local/share/applications"))) + " --delete-original " + EscapeShell(QFile::encodeName(file)))) { diff --git a/lib/xdg/telegramdesktop.desktop b/lib/xdg/telegramdesktop.desktop index 177f8a2cf4..bb2a8ea797 100644 --- a/lib/xdg/telegramdesktop.desktop +++ b/lib/xdg/telegramdesktop.desktop @@ -10,3 +10,4 @@ Type=Application Categories=Network;InstantMessaging;Qt; MimeType=x-scheme-handler/tg; Keywords=tg;chat;im;messaging;messenger;sms;tdesktop; +X-GNOME-UsesNotifications=true