mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Have notification subtitle in title on Linux when body-markup is not supported
This makes it look way better
This commit is contained in:
parent
a1a5ef9d39
commit
c134861cd9
1 changed files with 12 additions and 11 deletions
|
@ -385,12 +385,12 @@ bool NotificationData::init(
|
|||
const QString &msg,
|
||||
Window::Notifications::Manager::DisplayOptions options) {
|
||||
if (_application) {
|
||||
_notification = Gio::Notification::create(title.toStdString());
|
||||
|
||||
_notification->set_body(
|
||||
_notification = Gio::Notification::create(
|
||||
subtitle.isEmpty()
|
||||
? msg.toStdString()
|
||||
: u"%1\n%2"_q.arg(subtitle, msg).toStdString());
|
||||
? title.toStdString()
|
||||
: subtitle.toStdString() + " (" + title.toStdString() + ')');
|
||||
|
||||
_notification->set_body(msg.toStdString());
|
||||
|
||||
_notification->set_icon(
|
||||
Gio::ThemedIcon::create(base::IconName().toStdString()));
|
||||
|
@ -500,19 +500,22 @@ bool NotificationData::init(
|
|||
});
|
||||
};
|
||||
|
||||
_title = title.toStdString();
|
||||
_imageKey = GetImageKey(CurrentServerInformationValue().specVersion);
|
||||
|
||||
if (capabilities.contains(u"body-markup"_q)) {
|
||||
_title = title.toStdString();
|
||||
|
||||
_body = subtitle.isEmpty()
|
||||
? msg.toHtmlEscaped().toStdString()
|
||||
: u"<b>%1</b>\n%2"_q.arg(
|
||||
subtitle.toHtmlEscaped(),
|
||||
msg.toHtmlEscaped()).toStdString();
|
||||
} else {
|
||||
_body = subtitle.isEmpty()
|
||||
? msg.toStdString()
|
||||
: u"%1\n%2"_q.arg(subtitle, msg).toStdString();
|
||||
_title = subtitle.isEmpty()
|
||||
? title.toStdString()
|
||||
: subtitle.toStdString() + " (" + title.toStdString() + ')';
|
||||
|
||||
_body = msg.toStdString();
|
||||
}
|
||||
|
||||
if (capabilities.contains("actions")) {
|
||||
|
@ -820,8 +823,6 @@ bool ByDefault() {
|
|||
static const auto NeededCapabilities = {
|
||||
// To show message content
|
||||
u"body"_q,
|
||||
// To make the sender name bold
|
||||
u"body-markup"_q,
|
||||
// To have buttons on notifications
|
||||
u"actions"_q,
|
||||
// To have quick reply
|
||||
|
|
Loading…
Add table
Reference in a new issue