Notifications n shi
This commit is contained in:
83
Widgets/Notification.qml
Normal file
83
Widgets/Notification.qml
Normal file
@@ -0,0 +1,83 @@
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.Notifications
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
|
||||
Rectangle {
|
||||
id: notifRect
|
||||
required property var modelData
|
||||
|
||||
property bool exiting: false
|
||||
width: parent?.width ?? 0
|
||||
height: notifContent.childrenRect.height + 20
|
||||
radius: 8
|
||||
color: "#181818"
|
||||
|
||||
Rectangle {
|
||||
antialiasing: true
|
||||
color: "transparent"
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 12
|
||||
}
|
||||
radius: 8
|
||||
width: 40
|
||||
height: 40
|
||||
Image {
|
||||
id: notifIcon
|
||||
anchors.fill: parent
|
||||
source: modelData?.image ?? source
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id: notifContent
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
topMargin: 10
|
||||
leftMargin: 16 + (notifIcon.source == "" ? 0 : 44)
|
||||
rightMargin: 16
|
||||
}
|
||||
spacing: 4
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
color: "white"
|
||||
font.family: "Comfortaa"
|
||||
font.pixelSize: 16
|
||||
text: modelData?.summary ?? text
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.Wrap
|
||||
maximumLineCount: 2
|
||||
}
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
color: "white"
|
||||
font.family: "Comfortaa"
|
||||
font.pixelSize: 12
|
||||
text: modelData?.body ?? text
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.Wrap
|
||||
maximumLineCount: 4
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
running: modelData?.expireTimeout > 0
|
||||
interval: (modelData?.expireTimeout > 0) ? modelData?.expireTimeout : 0
|
||||
onTriggered: modelData.tracked = false
|
||||
}
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.MiddleButton
|
||||
onTapped: modelData.tracked = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user