First commit
This commit is contained in:
71
config/hybar/modules/Notif.qml
Normal file
71
config/hybar/modules/Notif.qml
Normal file
@@ -0,0 +1,71 @@
|
||||
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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user