notifs: put different icon representations in loaders

This commit is contained in:
end-4
2025-05-14 21:36:28 +02:00
parent c3c581fcaa
commit 2339eda157
@@ -208,8 +208,10 @@ Item {
}
}
DropShadow {
visible: popup
Loader {
active: popup
anchors.fill: notificationBackground
sourceComponent: DropShadow {
id: notificationShadow
anchors.fill: notificationBackground
source: notificationBackground
@@ -220,6 +222,7 @@ Item {
horizontalOffset: 0
}
}
}
Item {
@@ -274,8 +277,11 @@ Item {
Layout.fillWidth: false
radius: Appearance.rounding.full
color: Appearance.m3colors.m3secondaryContainer
MaterialSymbol {
visible: notificationObject.appIcon == ""
Loader {
id: materialSymbolLoader
active: notificationObject.appIcon == ""
anchors.fill: parent
sourceComponent: MaterialSymbol {
text: {
const defaultIcon = NotificationUtils.findSuitableMaterialSymbol("")
const guessedIcon = NotificationUtils.findSuitableMaterialSymbol(notificationObject.summary)
@@ -290,19 +296,25 @@ Item {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
IconImage {
visible: notificationObject.image == "" && notificationObject.appIcon != ""
}
Loader {
id: appIconLoader
active: notificationObject.image == "" && notificationObject.appIcon != ""
anchors.centerIn: parent
sourceComponent: IconImage {
implicitSize: 33
asynchronous: true
source: Quickshell.iconPath(notificationObject.appIcon)
}
Item {
}
Loader {
id: notifImageLoader
active: notificationObject.image != ""
anchors.fill: parent
sourceComponent: Item {
anchors.fill: parent
visible: notificationObject.image != ""
Image {
id: notifImage
anchors.fill: parent
readonly property int size: parent.width
@@ -326,16 +338,20 @@ Item {
}
}
}
IconImage {
visible: notificationObject.appIcon != ""
Loader {
id: notifImageAppIconLoader
active: notificationObject.appIcon != ""
anchors.bottom: parent.bottom
anchors.right: parent.right
sourceComponent: IconImage {
implicitSize: 23
asynchronous: true
source: Quickshell.iconPath(notificationObject.appIcon)
}
}
}
}
}
ColumnLayout { // Notification content
spacing: 0