From 33feaff81709a36a701ca4a1aa255bd9cedc6684 Mon Sep 17 00:00:00 2001
From: _xB <65196493+xBiei@users.noreply.github.com>
Date: Fri, 6 Jun 2025 01:04:12 +0300
Subject: [PATCH] notification: Fix Chromium-based notifs
---
.../common/widgets/NotificationItem.qml | 30 ++++++++++++++++---
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/.config/quickshell/modules/common/widgets/NotificationItem.qml b/.config/quickshell/modules/common/widgets/NotificationItem.qml
index 26286290c..33e901f62 100644
--- a/.config/quickshell/modules/common/widgets/NotificationItem.qml
+++ b/.config/quickshell/modules/common/widgets/NotificationItem.qml
@@ -35,6 +35,22 @@ Item { // Notification item area
implicitHeight: background.implicitHeight
+ function processNotificationBody(body, appName) {
+ let processedBody = body
+
+ // Handle Brave/Chrome notifications - remove first line
+ if (appName && appName.toLowerCase().includes('brave')) {
+ const lines = body.split('\n\n')
+ if (lines.length > 1) {
+ processedBody = lines.slice(1).join('\n\n')
+ }
+ }
+
+ // Remove HTML tags
+ processedBody = processedBody.replace(/<[^>]*>/g, '')
+ return processedBody
+ }
+
function destroyWithAnimation() {
root.qmlParent.resetDrag()
background.anchors.leftMargin = background.anchors.leftMargin; // Break binding
@@ -173,7 +189,10 @@ Item { // Notification item area
color: Appearance.colors.colSubtext
elide: Text.ElideRight
textFormat: Text.StyledText
- text: notificationObject.body.replace(/
img{max-width:${notificationBodyText.width}px;}` +
- `${notificationObject.body.replace(/\n/g, "
")}`
+ text: {
+ const processedBody = processNotificationBody(notificationObject.body, notificationObject.appName || notificationObject.summary)
+ return `` +
+ `${processedBody.replace(/\n/g, "
")}`
+ }
onLinkActivated: (link) => {
Qt.openUrlExternally(link)
@@ -298,4 +320,4 @@ Item { // Notification item area
}
}
}
-}
\ No newline at end of file
+}