feat(update): huge changes
This commit is contained in:
98 files changed
+9636
-5575
No files matched your search
@@ -4,7 +4,6 @@ from fabric.notifications import (
|
||||
Notification,
|
||||
NotificationAction,
|
||||
NotificationCloseReason,
|
||||
Notifications,
|
||||
)
|
||||
from loguru import logger
|
||||
from fabric.widgets.box import Box
|
||||
@@ -16,6 +15,7 @@ from fabric.widgets.revealer import Revealer
|
||||
from fabric.widgets.wayland import WaylandWindow as Window
|
||||
from utils import CustomImage
|
||||
import utils.icons as icons
|
||||
from services import notification_service
|
||||
|
||||
|
||||
class ActionButton(Button):
|
||||
@@ -267,7 +267,8 @@ class NotificationRevealer(Revealer):
|
||||
|
||||
class NotificationPopup(Window):
|
||||
def __init__(self):
|
||||
self._server = Notifications()
|
||||
self._server = notification_service
|
||||
self.cache_notification_service = notification_service
|
||||
self.notifications = Box(
|
||||
v_expand=True,
|
||||
h_expand=True,
|
||||
@@ -287,6 +288,15 @@ class NotificationPopup(Window):
|
||||
)
|
||||
|
||||
def on_new_notification(self, fabric_notif, id):
|
||||
new_box = NotificationRevealer(fabric_notif.get_notification_from_id(id))
|
||||
self.notifications.add(new_box)
|
||||
new_box.set_reveal_child(True)
|
||||
notification: Notification = fabric_notif.get_notification_from_id(id)
|
||||
# Always cache the notification regardless of DND status
|
||||
self.cache_notification_service.cache_notification(notification)
|
||||
|
||||
# Only show popup if DND is not enabled
|
||||
if not self.cache_notification_service.dont_disturb:
|
||||
new_box = NotificationRevealer(fabric_notif.get_notification_from_id(id))
|
||||
self.notifications.add(new_box)
|
||||
new_box.set_reveal_child(True)
|
||||
logger.info(f"[Notification] New notification from {notification.app_name}")
|
||||
else:
|
||||
logger.info(f"[Notification] DND enabled, notification from {notification.app_name} not shown")
|
||||
Reference in new issue
Block a user