From 05524c3f6c5a1a4688ed111b51317970b22fac8e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 29 Nov 2022 00:29:45 +0400 Subject: [PATCH] Don't show reply button in Linux native notifications when it's not supposed to All modern notification daemons have support for the default action and it's a requirement with the portal spec --- .../linux/notifications_manager_linux.cpp | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 569085613c..1b0bd93d6f 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -431,10 +431,12 @@ bool NotificationData::init( idTuple); } - _notification->add_button( - tr::lng_notification_reply(tr::now).toStdString(), - "app.notification-reply", - idTuple); + if (!options.hideReplyButton) { + _notification->add_button( + tr::lng_notification_reply(tr::now).toStdString(), + "app.notification-reply", + idTuple); + } return true; } @@ -520,22 +522,24 @@ bool NotificationData::init( tr::lng_context_mark_read(tr::now).toStdString()); } - if (capabilities.contains("inline-reply") && !options.hideReplyButton) { - _actions.push_back("inline-reply"); - _actions.push_back( - tr::lng_notification_reply(tr::now).toStdString()); + if (!options.hideReplyButton) { + if (capabilities.contains("inline-reply")) { + _actions.push_back("inline-reply"); + _actions.push_back( + tr::lng_notification_reply(tr::now).toStdString()); - _notificationRepliedSignalId = _dbusConnection->signal_subscribe( - signalEmitted, - std::string(kService), - std::string(kInterface), - "NotificationReplied", - std::string(kObjectPath)); - } else { - // icon name according to https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html - _actions.push_back("mail-reply-sender"); - _actions.push_back( - tr::lng_notification_reply(tr::now).toStdString()); + _notificationRepliedSignalId = _dbusConnection->signal_subscribe( + signalEmitted, + std::string(kService), + std::string(kInterface), + "NotificationReplied", + std::string(kObjectPath)); + } else { + // icon name according to https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html + _actions.push_back("mail-reply-sender"); + _actions.push_back( + tr::lng_notification_reply(tr::now).toStdString()); + } } _actionInvokedSignalId = _dbusConnection->signal_subscribe(