From 9dcd702fa40847ed2ccb49eefa4293d4ef6f89fc Mon Sep 17 00:00:00 2001 From: Arne Date: Sat, 22 Feb 2025 11:04:20 +0100 Subject: [PATCH 1/5] show user avatar when sending live notification --- src/singletons/Toasts.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/singletons/Toasts.cpp b/src/singletons/Toasts.cpp index 2c51e2a8a07..615ea9ec6ad 100644 --- a/src/singletons/Toasts.cpp +++ b/src/singletons/Toasts.cpp @@ -310,6 +310,21 @@ void Toasts::sendLibnotify(const QString &channelName, NotifyNotification *notif = notify_notification_new( str.toUtf8().constData(), channelTitle.toUtf8().constData(), nullptr); + if (hasAvatarForChannel(channelName)) + { + GdkPixbuf *img = gdk_pixbuf_new_from_file( + avatarFilePath(channelName).toUtf8().constData(), nullptr); + if (img == nullptr) + { + qWarning(chatterinoNotification) << "Failed to load user avatar image"; + } + else + { + notify_notification_set_image_from_pixbuf(notif, img); + g_object_unref(img); + } + } + notify_notification_show(notif, nullptr); g_object_unref(notif); } From 927cef85957ad24af0e5b5dc1c3fc5a3a53a2c1b Mon Sep 17 00:00:00 2001 From: Arne Date: Sat, 22 Feb 2025 11:15:08 +0100 Subject: [PATCH 2/5] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index babb653fd49..25d8e59deff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Minor: Improved error messaging of the `/clip` command. (#5879) - Minor: Added Linux support for Live Notifications toasts. (#5881) - Minor: Messages can now be deleted from the context menu in a channel. (#5956) +- Minor: Show user avatar in Live Nofications on Linux. (#5971) - Bugfix: Fixed a potential way to escape the Lua Plugin sandbox. (#5846) - Bugfix: Fixed a crash relating to Lua HTTP. (#5800) - Bugfix: Fixed a crash that could occur on Linux and macOS when clicking "Install" from the update prompt. (#5818) From 17ac08c0c8179e500317511157f3317edfc29cfe Mon Sep 17 00:00:00 2001 From: Arne Date: Sat, 22 Feb 2025 11:16:38 +0100 Subject: [PATCH 3/5] fix formatting --- src/singletons/Toasts.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/singletons/Toasts.cpp b/src/singletons/Toasts.cpp index 615ea9ec6ad..79280b31949 100644 --- a/src/singletons/Toasts.cpp +++ b/src/singletons/Toasts.cpp @@ -316,7 +316,8 @@ void Toasts::sendLibnotify(const QString &channelName, avatarFilePath(channelName).toUtf8().constData(), nullptr); if (img == nullptr) { - qWarning(chatterinoNotification) << "Failed to load user avatar image"; + qWarning(chatterinoNotification) + << "Failed to load user avatar image"; } else { From c194634a93776475fa4e8445f45d2ae253bdec0a Mon Sep 17 00:00:00 2001 From: Arne Date: Sat, 22 Feb 2025 13:32:36 +0100 Subject: [PATCH 4/5] fix changelog entry --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25d8e59deff..3a80c0f2346 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,8 @@ - Minor: When (re-)connecting, visible channels are now joined first. (#5850) - Minor: Added the ability to filter on messages by the author's user ID (example: `author.user_id == "22484632"`). (#5862) - Minor: Improved error messaging of the `/clip` command. (#5879) -- Minor: Added Linux support for Live Notifications toasts. (#5881) +- Minor: Added Linux support for Live Notifications toasts. (#5881, #5971) - Minor: Messages can now be deleted from the context menu in a channel. (#5956) -- Minor: Show user avatar in Live Nofications on Linux. (#5971) - Bugfix: Fixed a potential way to escape the Lua Plugin sandbox. (#5846) - Bugfix: Fixed a crash relating to Lua HTTP. (#5800) - Bugfix: Fixed a crash that could occur on Linux and macOS when clicking "Install" from the update prompt. (#5818) From c51bf403a1ecdd54d177d122e4c36cdcdb0ed22c Mon Sep 17 00:00:00 2001 From: Arne Date: Sat, 22 Feb 2025 13:35:52 +0100 Subject: [PATCH 5/5] remove hasAvatarForChannel check --- src/singletons/Toasts.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/singletons/Toasts.cpp b/src/singletons/Toasts.cpp index 79280b31949..5f67df44e3f 100644 --- a/src/singletons/Toasts.cpp +++ b/src/singletons/Toasts.cpp @@ -310,20 +310,16 @@ void Toasts::sendLibnotify(const QString &channelName, NotifyNotification *notif = notify_notification_new( str.toUtf8().constData(), channelTitle.toUtf8().constData(), nullptr); - if (hasAvatarForChannel(channelName)) + GdkPixbuf *img = gdk_pixbuf_new_from_file( + avatarFilePath(channelName).toUtf8().constData(), nullptr); + if (img == nullptr) { - GdkPixbuf *img = gdk_pixbuf_new_from_file( - avatarFilePath(channelName).toUtf8().constData(), nullptr); - if (img == nullptr) - { - qWarning(chatterinoNotification) - << "Failed to load user avatar image"; - } - else - { - notify_notification_set_image_from_pixbuf(notif, img); - g_object_unref(img); - } + qWarning(chatterinoNotification) << "Failed to load user avatar image"; + } + else + { + notify_notification_set_image_from_pixbuf(notif, img); + g_object_unref(img); } notify_notification_show(notif, nullptr);