diff options
Diffstat (limited to 'services')
| -rw-r--r-- | services/Notifs.qml | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/services/Notifs.qml b/services/Notifs.qml index 82ed8c4..4a89c7f 100644 --- a/services/Notifs.qml +++ b/services/Notifs.qml @@ -77,10 +77,8 @@ Singleton { onNotification: notif => { notif.tracked = true; - const shouldShowAsToast = !props.dnd && ![...Visibilities.screens.values()].some(v => v.sidebar); const comp = notifComp.createObject(root, { - popup: shouldShowAsToast, - showAsToast: shouldShowAsToast, + popup: !props.dnd && ![...Visibilities.screens.values()].some(v => v.sidebar), notification: notif }); root.list = [comp, ...root.list]; @@ -145,7 +143,6 @@ Singleton { property bool popup property bool closed - property bool showAsToast: false property var locks: new Set() property date time: new Date() @@ -179,74 +176,7 @@ Singleton { property bool hasActionIcons property list<var> actions - readonly property bool isCritical: urgency === NotificationUrgency.Critical - readonly property bool isLow: urgency === NotificationUrgency.Low - - function getBackgroundColor(): color { - if (isCritical) return Colours.palette.m3secondaryContainer; - return Colours.tPalette.m3surfaceContainer; - } - - function getBadgeBackgroundColor(): color { - if (isCritical) return Colours.palette.m3error; - if (isLow) return Colours.layer(Colours.palette.m3surfaceContainerHighest, 2); - return Colours.palette.m3secondaryContainer; - } - - function getIconColor(): color { - if (isCritical) return Colours.palette.m3onError; - if (isLow) return Colours.palette.m3onSurface; - return Colours.palette.m3onSecondaryContainer; - } - - function getStateLayerColor(): color { - if (isCritical) return Colours.palette.m3onSecondaryContainer; - return Colours.palette.m3onSurface; - } - - function getActionBackgroundColor(): color { - if (isCritical) return Colours.palette.m3secondary; - return Colours.layer(Colours.palette.m3surfaceContainerHigh, 2); - } - - function getActionTextColor(): color { - if (isCritical) return Colours.palette.m3onSecondary; - return Colours.palette.m3onSurfaceVariant; - } - readonly property Timer timer: Timer { - id: toastTimer - - running: notif.showAsToast - interval: { - let timeout = notif.expireTimeout; - if (timeout <= 0) { - switch (notif.urgency) { - case NotificationUrgency.Critical: - timeout = 10000; - break; - case NotificationUrgency.Normal: - timeout = 5000; - break; - case NotificationUrgency.Low: - timeout = 5000; - break; - default: - timeout = 5000; - } - } - return timeout; - } - onTriggered: { - if (Config.notifs.expire) - notif.popup = false; - if (notif.showAsToast) { - notif.showAsToast = false; - } - } - } - - readonly property Timer popupTimer: Timer { running: true interval: notif.expireTimeout > 0 ? notif.expireTimeout : Config.notifs.defaultExpireTimeout onTriggered: { |