forked from Shinonome/dots-hyprland
notifs: put different icon representations in loaders
This commit is contained in:
@@ -208,16 +208,19 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DropShadow {
|
Loader {
|
||||||
visible: popup
|
active: popup
|
||||||
id: notificationShadow
|
|
||||||
anchors.fill: notificationBackground
|
anchors.fill: notificationBackground
|
||||||
source: notificationBackground
|
sourceComponent: DropShadow {
|
||||||
radius: 5
|
id: notificationShadow
|
||||||
samples: radius * 2 + 1
|
anchors.fill: notificationBackground
|
||||||
color: Appearance.colors.colShadow
|
source: notificationBackground
|
||||||
verticalOffset: 2
|
radius: 5
|
||||||
horizontalOffset: 0
|
samples: radius * 2 + 1
|
||||||
|
color: Appearance.colors.colShadow
|
||||||
|
verticalOffset: 2
|
||||||
|
horizontalOffset: 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,67 +277,80 @@ Item {
|
|||||||
Layout.fillWidth: false
|
Layout.fillWidth: false
|
||||||
radius: Appearance.rounding.full
|
radius: Appearance.rounding.full
|
||||||
color: Appearance.m3colors.m3secondaryContainer
|
color: Appearance.m3colors.m3secondaryContainer
|
||||||
MaterialSymbol {
|
Loader {
|
||||||
visible: notificationObject.appIcon == ""
|
id: materialSymbolLoader
|
||||||
text: {
|
active: notificationObject.appIcon == ""
|
||||||
const defaultIcon = NotificationUtils.findSuitableMaterialSymbol("")
|
|
||||||
const guessedIcon = NotificationUtils.findSuitableMaterialSymbol(notificationObject.summary)
|
|
||||||
return (notificationObject.urgency == NotificationUrgency.Critical && guessedIcon === defaultIcon) ?
|
|
||||||
"release_alert" : guessedIcon
|
|
||||||
}
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: (notificationObject.urgency == NotificationUrgency.Critical) ?
|
sourceComponent: MaterialSymbol {
|
||||||
Appearance.mix(Appearance.m3colors.m3onSecondary, Appearance.m3colors.m3onSecondaryContainer, 0.1) :
|
text: {
|
||||||
Appearance.m3colors.m3onSecondaryContainer
|
const defaultIcon = NotificationUtils.findSuitableMaterialSymbol("")
|
||||||
iconSize: 27
|
const guessedIcon = NotificationUtils.findSuitableMaterialSymbol(notificationObject.summary)
|
||||||
horizontalAlignment: Text.AlignHCenter
|
return (notificationObject.urgency == NotificationUrgency.Critical && guessedIcon === defaultIcon) ?
|
||||||
verticalAlignment: Text.AlignVCenter
|
"release_alert" : guessedIcon
|
||||||
}
|
|
||||||
IconImage {
|
|
||||||
visible: notificationObject.image == "" && notificationObject.appIcon != ""
|
|
||||||
anchors.centerIn: parent
|
|
||||||
implicitSize: 33
|
|
||||||
asynchronous: true
|
|
||||||
source: Quickshell.iconPath(notificationObject.appIcon)
|
|
||||||
}
|
|
||||||
Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
visible: notificationObject.image != ""
|
|
||||||
Image {
|
|
||||||
id: notifImage
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
readonly property int size: parent.width
|
|
||||||
|
|
||||||
source: notificationObject?.image
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
cache: false
|
|
||||||
antialiasing: true
|
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
width: size
|
|
||||||
height: size
|
|
||||||
sourceSize.width: size
|
|
||||||
sourceSize.height: size
|
|
||||||
|
|
||||||
layer.enabled: true
|
|
||||||
layer.effect: OpacityMask {
|
|
||||||
maskSource: Rectangle {
|
|
||||||
width: notifImage.size
|
|
||||||
height: notifImage.size
|
|
||||||
radius: Appearance.rounding.full
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
anchors.fill: parent
|
||||||
|
color: (notificationObject.urgency == NotificationUrgency.Critical) ?
|
||||||
|
Appearance.mix(Appearance.m3colors.m3onSecondary, Appearance.m3colors.m3onSecondaryContainer, 0.1) :
|
||||||
|
Appearance.m3colors.m3onSecondaryContainer
|
||||||
|
iconSize: 27
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
IconImage {
|
}
|
||||||
visible: notificationObject.appIcon != ""
|
Loader {
|
||||||
anchors.bottom: parent.bottom
|
id: appIconLoader
|
||||||
anchors.right: parent.right
|
active: notificationObject.image == "" && notificationObject.appIcon != ""
|
||||||
implicitSize: 23
|
anchors.centerIn: parent
|
||||||
|
sourceComponent: IconImage {
|
||||||
|
implicitSize: 33
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
source: Quickshell.iconPath(notificationObject.appIcon)
|
source: Quickshell.iconPath(notificationObject.appIcon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loader {
|
||||||
|
id: notifImageLoader
|
||||||
|
active: notificationObject.image != ""
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceComponent: Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
Image {
|
||||||
|
id: notifImage
|
||||||
|
anchors.fill: parent
|
||||||
|
readonly property int size: parent.width
|
||||||
|
|
||||||
|
source: notificationObject?.image
|
||||||
|
fillMode: Image.PreserveAspectCrop
|
||||||
|
cache: false
|
||||||
|
antialiasing: true
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
width: size
|
||||||
|
height: size
|
||||||
|
sourceSize.width: size
|
||||||
|
sourceSize.height: size
|
||||||
|
|
||||||
|
layer.enabled: true
|
||||||
|
layer.effect: OpacityMask {
|
||||||
|
maskSource: Rectangle {
|
||||||
|
width: notifImage.size
|
||||||
|
height: notifImage.size
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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
|
ColumnLayout { // Notification content
|
||||||
|
|||||||
Reference in New Issue
Block a user