forked from Shinonome/dots-hyprland
notifications: handle images
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
import "root:/services"
|
import "root:/services"
|
||||||
|
import Qt5Compat.GraphicalEffects
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
@@ -109,12 +110,50 @@ Item {
|
|||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
IconImage {
|
IconImage {
|
||||||
visible: notificationObject.appIcon != ""
|
visible: notificationObject.image == "" && notificationObject.appIcon != ""
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
implicitSize: 33
|
implicitSize: 33
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
source: Quickshell.iconPath(notificationObject.appIcon)
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IconImage {
|
||||||
|
visible: notificationObject.appIcon != ""
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
implicitSize: 23
|
||||||
|
asynchronous: true
|
||||||
|
source: Quickshell.iconPath(notificationObject.appIcon)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ColumnLayout { // Notification content
|
ColumnLayout { // Notification content
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@@ -212,7 +251,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
Flickable {
|
Flickable {
|
||||||
id: actionsFlickable
|
id: actionsFlickable
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ Singleton {
|
|||||||
// bodyImagesSupported: true
|
// bodyImagesSupported: true
|
||||||
bodyMarkupSupported: true
|
bodyMarkupSupported: true
|
||||||
bodySupported: true
|
bodySupported: true
|
||||||
// imageSupported: true
|
imageSupported: true
|
||||||
keepOnReload: false // I can't figure out RetainableLock, using a custom solution with a json file instead
|
keepOnReload: false
|
||||||
persistenceSupported: true
|
persistenceSupported: true
|
||||||
|
|
||||||
onNotification: (notification) => {
|
onNotification: (notification) => {
|
||||||
@@ -41,6 +41,7 @@ Singleton {
|
|||||||
"appIcon": notification.appIcon,
|
"appIcon": notification.appIcon,
|
||||||
"appName": notification.appName,
|
"appName": notification.appName,
|
||||||
"body": notification.body,
|
"body": notification.body,
|
||||||
|
"image": notification.image,
|
||||||
"summary": notification.summary,
|
"summary": notification.summary,
|
||||||
"time": Date.now(),
|
"time": Date.now(),
|
||||||
"urgency": notification.urgency.toString(),
|
"urgency": notification.urgency.toString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user