72 lines
2.0 KiB
QML
72 lines
2.0 KiB
QML
import Quickshell
|
|
import QtQuick // for Text
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import Quickshell.Services.Notifications
|
|
import Quickshell.Io
|
|
import Quickshell.Widgets
|
|
import Quickshell.Hyprland
|
|
|
|
ClippingWrapperRectangle {
|
|
id: notif
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
|
Layout.margins: 5
|
|
radius: 10
|
|
implicitWidth: parent.width - 2 * Layout.margins
|
|
implicitHeight: 100
|
|
|
|
color: Pywal.colors.color2
|
|
|
|
required property Notification src
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
|
|
RowLayout {
|
|
Image {
|
|
//anchors.fill: parent
|
|
source: {
|
|
console.log(notif.src)
|
|
let icon = notif.src.image
|
|
if (icon.includes("?path=")) {
|
|
const [name, path] = icon.split("?path=");
|
|
icon = Qt.resolvedUrl(`${path}/${name.slice(name.lastIndexOf("/") + 1)}`);
|
|
}
|
|
return icon
|
|
}
|
|
|
|
Layout.maximumWidth: 100
|
|
Layout.maximumHeight: 100
|
|
}
|
|
|
|
ColumnLayout {
|
|
Layout.topMargin: 10
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
Text {
|
|
color: Pywal.special.background
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
text: notif.src.summary
|
|
Layout.leftMargin: 10
|
|
font.pointSize: 14
|
|
}
|
|
Text {
|
|
color: Pywal.special.background
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
|
text: notif.src.body
|
|
Layout.leftMargin: 10
|
|
font.pointSize: 12
|
|
}
|
|
}
|
|
}
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
onClicked: mouse => {
|
|
if(mouse.button == Qt.LeftButton) {
|
|
notif.src.dismiss()
|
|
} else if(mouse.button == Qt.RightButton) {
|
|
}
|
|
}
|
|
}
|
|
}
|