From 6b7348ea204e78e4454b4bc17ff2c3b7fdd2cb97 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Mon, 6 Jul 2026 17:34:30 +0545 Subject: [PATCH] refactor(src/window/notification): adjust notification markup handling and UI width constraints - Escape markup text for summary and body to prevent injection - Simplify Label creation for body with conditional null check - Increase max_chars_width for summary and body lines - Remove wrap and wrap_mode settings --- .../notification/notification_center.py | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/window/notification/notification_center.py b/src/window/notification/notification_center.py index 5bfb3e5..b4c1a64 100644 --- a/src/window/notification/notification_center.py +++ b/src/window/notification/notification_center.py @@ -118,22 +118,33 @@ class ExpandableNotificationGroup(Box): children=[ Label( name="notification-summary", - markup=f"{self.app_name}", + markup=escape_markup_text( + latest_notification._notification.summary.replace( + "\n", " " + ) + ), h_align="start", + max_chars_width=25, ellipsization="end", ), ], ), - Label( - name="notification-body", - markup=escape_markup_text( - latest_notification._notification.summary.replace( - "\n", " " - ) - ), - max_chars_width=25, - h_align="start", - ellipsization="end", + ( + Label( + markup=escape_markup_text( + latest_notification._notification.body.replace( + "\n", " " + ) + ), + max_chars_width=25, + h_align="start", + ellipsization="end", + ) + if latest_notification._notification.body + else Label( + markup="", + h_align="start", + ) ), ], ), @@ -543,9 +554,8 @@ class NotificationCenterWidget(NotificationWidget): notification.summary.replace("\n", " ") ), h_align="start", - wrap=True, - wrap_mode="word-char", - max_chars_width=30, + max_chars_width=40, + ellipsization="end", ), ], ), @@ -555,9 +565,8 @@ class NotificationCenterWidget(NotificationWidget): notification.body.replace("\n", " ") ), h_align="start", - wrap=True, - wrap_mode="word-char", - max_chars_width=35, + max_chars_width=45, + ellipsization="end", ) if notification.body else Label(