summaryrefslogtreecommitdiff
path: root/modules/notifications
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-10 23:25:38 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-10 23:25:38 +1000
commitbcb0b3df39608db0384dc3a8df29236c8bd5271f (patch)
tree2feffad75c637fe69e422fc2794e33f6f7983c41 /modules/notifications
parentnotifs: colour by urgency (diff)
downloadcaelestia-shell-bcb0b3df39608db0384dc3a8df29236c8bd5271f.tar.gz
caelestia-shell-bcb0b3df39608db0384dc3a8df29236c8bd5271f.tar.bz2
caelestia-shell-bcb0b3df39608db0384dc3a8df29236c8bd5271f.zip
notifs: all notifs have icon
Guess icon or default
Diffstat (limited to 'modules/notifications')
-rw-r--r--modules/notifications/Notification.qml59
1 files changed, 52 insertions, 7 deletions
diff --git a/modules/notifications/Notification.qml b/modules/notifications/Notification.qml
index a6329e3..bacf192 100644
--- a/modules/notifications/Notification.qml
+++ b/modules/notifications/Notification.qml
@@ -98,8 +98,8 @@ StyledRect {
anchors.left: parent.left
anchors.top: parent.top
- width: root.hasImage || root.hasAppIcon ? root.imageSize : 0
- height: root.hasImage || root.hasAppIcon ? root.imageSize : 0
+ width: root.imageSize
+ height: root.imageSize
visible: root.hasImage || root.hasAppIcon
sourceComponent: ClippingRectangle {
@@ -120,7 +120,7 @@ StyledRect {
Loader {
id: appIcon
- active: root.hasAppIcon
+ active: root.hasAppIcon || !root.hasImage
asynchronous: true
anchors.horizontalCenter: root.hasImage ? undefined : image.horizontalCenter
@@ -134,14 +134,23 @@ StyledRect {
implicitWidth: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize
implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize
- IconImage {
+ Loader {
id: icon
+ active: root.hasAppIcon
+ asynchronous: true
+
anchors.centerIn: parent
visible: !root.modelData.appIcon.includes("symbolic")
- implicitSize: Math.round(parent.width * 0.6)
- source: Quickshell.iconPath(root.modelData.appIcon)
- asynchronous: true
+
+ width: Math.round(parent.width * 0.6)
+ height: Math.round(parent.width * 0.6)
+
+ sourceComponent: IconImage {
+ implicitSize: Math.round(parent.width * 0.6)
+ source: Quickshell.iconPath(root.modelData.appIcon)
+ asynchronous: true
+ }
}
Loader {
@@ -154,6 +163,42 @@ StyledRect {
colorizationColor: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3onError : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3onSurface : Colours.palette.m3onTertiaryContainer
}
}
+
+ Loader {
+ active: !root.hasAppIcon
+ asynchronous: true
+ anchors.centerIn: parent
+
+ sourceComponent: MaterialIcon {
+ text: {
+ const summary = root.modelData.summary.toLowerCase();
+ if (summary.includes("reboot"))
+ return "restart_alt";
+ if (summary.includes("recording"))
+ return "screen_record";
+ if (summary.includes("battery"))
+ return "power";
+ if (summary.includes("screenshot"))
+ return "screenshot_monitor";
+ if (summary.includes("welcome"))
+ return "waving_hand";
+ if (summary.includes("time"))
+ return "schedule";
+ if (summary.includes("installed"))
+ return "download";
+ if (summary.includes("update"))
+ return "update";
+ if (summary.startsWith("file"))
+ return "folder_copy";
+ if (root.modelData.urgency === NotificationUrgency.Critical)
+ return "release_alert";
+ return "chat";
+ }
+
+ color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3onError : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3onSurface : Colours.palette.m3onTertiaryContainer
+ font.pointSize: Appearance.font.size.large
+ }
+ }
}
}