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
|
@ -385,12 +385,12 @@ bool NotificationData::init(
|
||||||
const QString &msg,
|
const QString &msg,
|
||||||
Window::Notifications::Manager::DisplayOptions options) {
|
Window::Notifications::Manager::DisplayOptions options) {
|
||||||
if (_application) {
|
if (_application) {
|
||||||
_notification = Gio::Notification::create(title.toStdString());
|
_notification = Gio::Notification::create(
|
||||||
|
|
||||||
_notification->set_body(
|
|
||||||
subtitle.isEmpty()
|
subtitle.isEmpty()
|
||||||
? msg.toStdString()
|
? title.toStdString()
|
||||||
: u"%1\n%2"_q.arg(subtitle, msg).toStdString());
|
: subtitle.toStdString() + " (" + title.toStdString() + ')');
|
||||||
|
|
||||||
|
_notification->set_body(msg.toStdString());
|
||||||
|
|
||||||
_notification->set_icon(
|
_notification->set_icon(
|
||||||
Gio::ThemedIcon::create(base::IconName().toStdString()));
|
Gio::ThemedIcon::create(base::IconName().toStdString()));
|
||||||
|
@ -500,19 +500,22 @@ bool NotificationData::init(
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_title = title.toStdString();
|
|
||||||
_imageKey = GetImageKey(CurrentServerInformationValue().specVersion);
|
_imageKey = GetImageKey(CurrentServerInformationValue().specVersion);
|
||||||
|
|
||||||
if (capabilities.contains(u"body-markup"_q)) {
|
if (capabilities.contains(u"body-markup"_q)) {
|
||||||
|
_title = title.toStdString();
|
||||||
|
|
||||||
_body = subtitle.isEmpty()
|
_body = subtitle.isEmpty()
|
||||||
? msg.toHtmlEscaped().toStdString()
|
? msg.toHtmlEscaped().toStdString()
|
||||||
: u"<b>%1</b>\n%2"_q.arg(
|
: u"<b>%1</b>\n%2"_q.arg(
|
||||||
subtitle.toHtmlEscaped(),
|
subtitle.toHtmlEscaped(),
|
||||||
msg.toHtmlEscaped()).toStdString();
|
msg.toHtmlEscaped()).toStdString();
|
||||||
} else {
|
} else {
|
||||||
_body = subtitle.isEmpty()
|
_title = subtitle.isEmpty()
|
||||||
? msg.toStdString()
|
? title.toStdString()
|
||||||
: u"%1\n%2"_q.arg(subtitle, msg).toStdString();
|
: subtitle.toStdString() + " (" + title.toStdString() + ')';
|
||||||
|
|
||||||
|
_body = msg.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (capabilities.contains("actions")) {
|
if (capabilities.contains("actions")) {
|
||||||
|
@ -820,8 +823,6 @@ bool ByDefault() {
|
||||||
static const auto NeededCapabilities = {
|
static const auto NeededCapabilities = {
|
||||||
// To show message content
|
// To show message content
|
||||||
u"body"_q,
|
u"body"_q,
|
||||||
// To make the sender name bold
|
|
||||||
u"body-markup"_q,
|
|
||||||
// To have buttons on notifications
|
// To have buttons on notifications
|
||||||
u"actions"_q,
|
u"actions"_q,
|
||||||
// To have quick reply
|
// To have quick reply
|
||||||
|
|
Loading…
Reference in New Issue