From 1eef83e9418b508fc5ed109e8687a8a3e856d261 Mon Sep 17 00:00:00 2001 From: tr1x_em Date: Sun, 10 Aug 2025 22:52:47 +0530 Subject: [PATCH] Fixed Notifiactions going out of screen --- modules/notification/notification.py | 3 ++- modules/notification/notification_center.py | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/notification/notification.py b/modules/notification/notification.py index a720de4..c09c50e 100644 --- a/modules/notification/notification.py +++ b/modules/notification/notification.py @@ -506,7 +506,7 @@ class NotificationWidget(Box): name="notification-summary", markup=notification.summary.replace("\n", " "), h_align="start", - max_chars_width=30, + max_chars_width=40, ellipsization="end", ), # Label( @@ -521,6 +521,7 @@ class NotificationWidget(Box): Label( markup=notification.body.replace("\n", " "), h_align="start", + max_chars_width=45, ellipsization="end", ) if notification.body diff --git a/modules/notification/notification_center.py b/modules/notification/notification_center.py index 365722d..469d273 100644 --- a/modules/notification/notification_center.py +++ b/modules/notification/notification_center.py @@ -341,7 +341,7 @@ class ExpandableNotificationGroup(Box): # Show header immediately (no animation on expand) self.header_revealer.set_reveal_child(True) - + # Ensure crossfade is revealed for expand self.notifications_crossfade.set_reveal_child(True) @@ -356,24 +356,27 @@ class ExpandableNotificationGroup(Box): # Start header slide-up and notifications crossfade simultaneously self.header_revealer.set_reveal_child(False) self.notifications_crossfade.set_reveal_child(False) - + # Show collapsed state and hide expanded container halfway through crossfade GLib.timeout_add(125, self._show_collapsed_midway) # After crossfade completes, start slide-up animation (just for cleanup) - GLib.timeout_add(260, lambda: self.notifications_revealer.set_reveal_child(False)) + GLib.timeout_add( + 260, lambda: self.notifications_revealer.set_reveal_child(False) + ) logger.debug(f"Collapsed notification group: {self.app_name}") - + def _show_collapsed_midway(self): """Show collapsed state and hide expanded container to prevent deformation""" self.collapsed_eventbox.set_visible(True) self.expanded_container.set_visible(False) return False # Don't repeat timeout - + def _complete_collapse(self): """Complete the collapse animation - no longer needed but kept for compatibility""" return False # Don't repeat timeout + def close_all(self, *args): # Close all notifications in this group for notification in self.notifications: @@ -490,6 +493,7 @@ class NotificationCenterWidget(NotificationWidget): name="notification-summary", markup=notification.summary.replace("\n", " "), h_align="start", + max_chars_width=30, ellipsization="end", ), ], @@ -498,6 +502,7 @@ class NotificationCenterWidget(NotificationWidget): Label( markup=notification.body.replace("\n", " "), h_align="start", + max_chars_width=35, ellipsization="end", ) if notification.body @@ -798,4 +803,3 @@ class NotificationCenter(Window): notification_service.disconnect("notify::count", self.on_count_changed) except Exception as e: logger.error(f"Error disconnecting signals: {e}") -