72 lines
1.7 KiB
QML
72 lines
1.7 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Wayland
|
|
import Quickshell.Services.Notifications
|
|
import "../../config"
|
|
|
|
Variants {
|
|
id: root
|
|
|
|
required property var manager
|
|
|
|
model: Quickshell.screens
|
|
|
|
delegate: PanelWindow {
|
|
id: popupWindow
|
|
screen: modelData
|
|
color: "transparent"
|
|
|
|
anchors.top: true
|
|
anchors.right: true
|
|
|
|
width: 380
|
|
height: Math.min(implicitHeight, screen.height * 0.6)
|
|
|
|
WlrLayershell.layer: WlrLayer.Overlay
|
|
WlrLayershell.namespace: "notification-popup"
|
|
|
|
margins {
|
|
top: 8
|
|
right: 8
|
|
}
|
|
|
|
readonly property var hyprMonitor: Hyprland.monitorFor(screen)
|
|
visible: hyprMonitor === Hyprland.focusedMonitor
|
|
|
|
implicitHeight: contentColumn.height
|
|
|
|
Connections {
|
|
target: Hyprland
|
|
function onFocusedMonitorChanged() {
|
|
popupWindow.visible = popupWindow.hyprMonitor === Hyprland.focusedMonitor
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: root.manager.notifications
|
|
function onCountChanged() {
|
|
popupWindow.visible = popupWindow.hyprMonitor === Hyprland.focusedMonitor
|
|
&& root.manager.notifications.count > 0
|
|
}
|
|
}
|
|
|
|
Column {
|
|
id: contentColumn
|
|
width: parent.width
|
|
spacing: 8
|
|
topPadding: 4
|
|
|
|
Repeater {
|
|
model: root.manager.notifications
|
|
|
|
delegate: NotificationCard {
|
|
width: contentColumn.width
|
|
notification: modelData
|
|
manager: root.manager
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|