notifs: all notifs have icon
Guess icon or default
This commit is contained in:
parent
5c807fc549
commit
bcb0b3df39
1 changed files with 52 additions and 7 deletions
|
|
@ -98,8 +98,8 @@ StyledRect {
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
width: root.hasImage || root.hasAppIcon ? root.imageSize : 0
|
width: root.imageSize
|
||||||
height: root.hasImage || root.hasAppIcon ? root.imageSize : 0
|
height: root.imageSize
|
||||||
visible: root.hasImage || root.hasAppIcon
|
visible: root.hasImage || root.hasAppIcon
|
||||||
|
|
||||||
sourceComponent: ClippingRectangle {
|
sourceComponent: ClippingRectangle {
|
||||||
|
|
@ -120,7 +120,7 @@ StyledRect {
|
||||||
Loader {
|
Loader {
|
||||||
id: appIcon
|
id: appIcon
|
||||||
|
|
||||||
active: root.hasAppIcon
|
active: root.hasAppIcon || !root.hasImage
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|
||||||
anchors.horizontalCenter: root.hasImage ? undefined : image.horizontalCenter
|
anchors.horizontalCenter: root.hasImage ? undefined : image.horizontalCenter
|
||||||
|
|
@ -134,14 +134,23 @@ StyledRect {
|
||||||
implicitWidth: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize
|
implicitWidth: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize
|
||||||
implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize
|
implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize
|
||||||
|
|
||||||
IconImage {
|
Loader {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
||||||
|
active: root.hasAppIcon
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: !root.modelData.appIcon.includes("symbolic")
|
visible: !root.modelData.appIcon.includes("symbolic")
|
||||||
implicitSize: Math.round(parent.width * 0.6)
|
|
||||||
source: Quickshell.iconPath(root.modelData.appIcon)
|
width: Math.round(parent.width * 0.6)
|
||||||
asynchronous: true
|
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 {
|
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
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue