Fix Expanded Notifiaction Not Showing

This commit is contained in:
tr1x_em committed 2025-08-09 20:50:52 +05:30
1 parent 217e0f6936
commit 3832c561c9
1 file changed
+22 -12
+22 -12
View File
@@ -29,13 +29,13 @@ class ExpandableNotificationGroup(Box):
self.app_name = app_name self.app_name = app_name
self.notifications = notifications self.notifications = notifications
self.is_expanded = False # Always start collapsed self.is_expanded = False # Always start collapsed
# Create collapsed state first (shows only latest notification) # Create collapsed state first (shows only latest notification)
self.create_collapsed_state() self.create_collapsed_state()
# Create expanded state (hidden initially) # Create expanded state (hidden initially)
self.create_expanded_state() self.create_expanded_state()
# Ensure we start in collapsed state # Ensure we start in collapsed state
self.collapsed_eventbox.set_visible(True) self.collapsed_eventbox.set_visible(True)
self.expanded_box.set_visible(False) self.expanded_box.set_visible(False)
@@ -105,7 +105,9 @@ class ExpandableNotificationGroup(Box):
icon_name="close-symbolic", icon_size=18 icon_name="close-symbolic", icon_size=18
), ),
visible=True, visible=True,
on_clicked=lambda *_: self._close_single_notification_and_stop_propagation(latest_notification), on_clicked=lambda *_: self._close_single_notification_and_stop_propagation(
latest_notification
),
), ),
Box(v_expand=True), Box(v_expand=True),
], ],
@@ -189,13 +191,15 @@ class ExpandableNotificationGroup(Box):
icon_name="close-symbolic", icon_size=18 icon_name="close-symbolic", icon_size=18
), ),
visible=True, visible=True,
on_clicked=lambda *_: self._close_single_notification_and_stop_propagation(latest_notification), on_clicked=lambda *_: self._close_single_notification_and_stop_propagation(
latest_notification
),
), ),
Label( Label(
name="notification-count-label", name="notification-count-label",
label=f"{len(self.notifications)}", label=f"{len(self.notifications)}",
h_align="end", h_align="end",
) ),
], ],
), ),
], ],
@@ -285,9 +289,13 @@ class ExpandableNotificationGroup(Box):
return get_fallback_notification_icon((35, 35)) return get_fallback_notification_icon((35, 35))
def on_clicked(self, widget, event): def on_clicked(self, widget, event):
logger.debug(f"Notification group clicked: {self.app_name}, button: {event.button}") logger.debug(
f"Notification group clicked: {self.app_name}, button: {event.button}"
)
if event.button == 1: # Left click if event.button == 1: # Left click
if len(self.notifications) > 1: # Only expand if there are multiple notifications if (
len(self.notifications) > 1
): # Only expand if there are multiple notifications
self.expand() self.expand()
else: else:
logger.debug("Single notification group - no expansion needed") logger.debug("Single notification group - no expansion needed")
@@ -322,7 +330,7 @@ class ExpandableNotificationGroup(Box):
logger.error( logger.error(
f"Error removing notification {notification.cache_id}: {e}" f"Error removing notification {notification.cache_id}: {e}"
) )
def _close_single_notification(self, notification): def _close_single_notification(self, notification):
"""Close a single notification from this group""" """Close a single notification from this group"""
try: try:
@@ -335,8 +343,10 @@ class ExpandableNotificationGroup(Box):
notification_service.remove_cached_notification(notification.cache_id) notification_service.remove_cached_notification(notification.cache_id)
logger.debug(f"Closed single notification: {notification.cache_id}") logger.debug(f"Closed single notification: {notification.cache_id}")
except Exception as e: except Exception as e:
logger.error(f"Error removing single notification {notification.cache_id}: {e}") logger.error(
f"Error removing single notification {notification.cache_id}: {e}"
)
def _close_single_notification_and_stop_propagation(self, notification): def _close_single_notification_and_stop_propagation(self, notification):
"""Close notification and prevent click from expanding the group""" """Close notification and prevent click from expanding the group"""
self._close_single_notification(notification) self._close_single_notification(notification)