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 1/4] 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 +} From 975c469e1a371b78d580174c3e0c948ad448f0c9 Mon Sep 17 00:00:00 2001 From: _xB <65196493+xBiei@users.noreply.github.com> Date: Fri, 13 Jun 2025 23:29:17 +0300 Subject: [PATCH 2/4] notifications: re-add support for HTML tags --- .../modules/common/widgets/NotificationItem.qml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.config/quickshell/modules/common/widgets/NotificationItem.qml b/.config/quickshell/modules/common/widgets/NotificationItem.qml index 33e901f62..47e7cdee2 100644 --- a/.config/quickshell/modules/common/widgets/NotificationItem.qml +++ b/.config/quickshell/modules/common/widgets/NotificationItem.qml @@ -41,13 +41,11 @@ Item { // Notification item area // Handle Brave/Chrome notifications - remove first line if (appName && appName.toLowerCase().includes('brave')) { const lines = body.split('\n\n') - if (lines.length > 1) { + if (lines.length > 1 && lines[0].startsWith(']*>/g, '') return processedBody } @@ -190,8 +188,7 @@ Item { // Notification item area elide: Text.ElideRight textFormat: Text.StyledText text: { - const processedBody = processNotificationBody(notificationObject.body, notificationObject.appName || notificationObject.summary) - return processedBody.replace(/img{max-width:${notificationBodyText.width}px;}` + - `${processedBody.replace(/\n/g, "
")}` + `${processNotificationBody(notificationObject.body, notificationObject.appName || notificationObject.summary).replace(/\n/g, "
")}` } onLinkActivated: (link) => { From 2e472450c588f033962aa50f7384677bfe69a48e Mon Sep 17 00:00:00 2001 From: _xB <65196493+xBiei@users.noreply.github.com> Date: Fri, 13 Jun 2025 23:45:18 +0300 Subject: [PATCH 3/4] notifications: support popular chromium-based browsers --- .../common/widgets/NotificationItem.qml | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.config/quickshell/modules/common/widgets/NotificationItem.qml b/.config/quickshell/modules/common/widgets/NotificationItem.qml index 47e7cdee2..4622fcde3 100644 --- a/.config/quickshell/modules/common/widgets/NotificationItem.qml +++ b/.config/quickshell/modules/common/widgets/NotificationItem.qml @@ -38,11 +38,19 @@ Item { // Notification item area 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 && lines[0].startsWith(' lowerApp.includes(name))) { + const lines = body.split('\n\n') + + if (lines.length > 1 && lines[0].startsWith('") } } } From c96f2f5eb4244dcf8621297d6c4fcf7408a976e9 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 13 Jun 2025 23:00:59 +0200 Subject: [PATCH 4/4] notif filter: remove redundant "edge" --- .config/quickshell/modules/common/widgets/NotificationItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/quickshell/modules/common/widgets/NotificationItem.qml b/.config/quickshell/modules/common/widgets/NotificationItem.qml index 4622fcde3..d1cf51351 100644 --- a/.config/quickshell/modules/common/widgets/NotificationItem.qml +++ b/.config/quickshell/modules/common/widgets/NotificationItem.qml @@ -42,7 +42,7 @@ Item { // Notification item area if (appName) { const lowerApp = appName.toLowerCase() const chromiumBrowsers = [ - "brave", "chrome", "chromium", "vivaldi", "opera", "microsoft edge", "edge" + "brave", "chrome", "chromium", "vivaldi", "opera", "microsoft edge" ] if (chromiumBrowsers.some(name => lowerApp.includes(name))) {