Files
Quickbar/Widgets/NotificationWindow.qml

104 lines
2.5 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Widgets
import qs.Services
import qs.Widgets
import qs.Common.Styled
import qs.Common
import Quickshell.Wayland
PanelWindow {
id: root
anchors {
left: true
bottom: true
right: true
top: true
}
implicitWidth: screen.width
// implicitWidth: 400
implicitHeight: screen.height
color: "transparent"
visible: true
signal clear
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
contentItem {
focus: true
Keys.onPressed: event => {
if (event.key == Qt.Key_Escape)
root.clear();
}
}
MouseArea {
anchors.fill: parent
onClicked: root.clear()
}
Rectangle {
id: notifWindow
anchors {
top: parent.top
left: parent.left
}
border.width: 1
color: Theme.color2
implicitWidth: 400
implicitHeight: Math.min(listView.contentHeight, 1090) + 50
ColumnLayout {
id: windowLayout
anchors.fill: parent
spacing: 0
BackgroundRectangle {
implicitWidth: parent.width
implicitHeight: 25
radius: 0
border.width: 0
MouseArea {
anchors.fill: parent
onClicked: {
while (NotificationService.notificationsNumber != 0) {
NotificationService.notificationDismiss(NotificationService.trackedNotifications.get(0).notif);
}
}
}
StyledText {
anchors.fill: parent
text: "NOTIFICAÇÕES"
}
}
ListView {
id: listView
Layout.fillWidth: true
Layout.fillHeight: true
model: NotificationService.trackedNotifications
clip: true
spacing: 5
leftMargin: 10
rightMargin: 10
delegate: NotificationWrapper {
required property var modelData
notification: modelData
implicitWidth: listView.width - 20
onDismissed: {
NotificationService.notificationDismiss(notification);
}
}
}
}
}
}