pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts import Quickshell.Widgets import Caelestia.Config import qs.components import qs.components.containers import qs.components.controls import qs.components.effects import qs.services import qs.utils Item { id: root required property Props props required property DrawerVisibilities visibilities readonly property int notifCount: Notifs.list.reduce((acc, n) => n.closed ? acc : acc + 1, 0) anchors.fill: parent anchors.margins: Tokens.padding.medium Component.onCompleted: Notifs.list.forEach(n => n.popup = false) Item { id: title anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right anchors.margins: Tokens.padding.extraSmall implicitHeight: Math.max(count.implicitHeight, titleText.implicitHeight) StyledText { id: count anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: root.notifCount > 0 ? 0 : -width - titleText.anchors.leftMargin opacity: root.notifCount > 0 ? 1 : 0 text: root.notifCount color: Colours.palette.m3outline font: Tokens.font.mono.builders.medium.weight(500).build() Behavior on anchors.leftMargin { Anim {} } Behavior on opacity { Anim {} } } StyledText { id: titleText anchors.verticalCenter: parent.verticalCenter anchors.left: count.right anchors.right: parent.right anchors.leftMargin: Tokens.spacing.small text: root.notifCount > 0 ? qsTr("notification%1").arg(root.notifCount === 1 ? "" : "s") : qsTr("Notifications") color: Colours.palette.m3outline font: Tokens.font.mono.builders.medium.weight(500).build() elide: Text.ElideRight } } ClippingRectangle { id: clipRect anchors.left: parent.left anchors.right: parent.right anchors.top: title.bottom anchors.bottom: parent.bottom anchors.topMargin: Tokens.spacing.medium radius: Tokens.rounding.medium color: "transparent" Loader { asynchronous: true anchors.centerIn: parent active: opacity > 0 opacity: root.notifCount > 0 ? 0 : 1 sourceComponent: ColumnLayout { spacing: Tokens.spacing.largeIncreased Image { asynchronous: true source: Paths.absolutePath(Config.paths.noNotifsPic) fillMode: Image.PreserveAspectFit sourceSize.width: clipRect.width * 0.8 layer.enabled: true layer.effect: Colouriser { colorizationColor: Colours.palette.m3outlineVariant brightness: 1 } } StyledText { Layout.alignment: Qt.AlignHCenter text: qsTr("No Notifications") color: Colours.palette.m3outlineVariant font: Tokens.font.mono.builders.large.weight(500).build() } } Behavior on opacity { Anim { type: Anim.StandardExtraLarge } } } StyledFlickable { id: view anchors.fill: parent flickableDirection: Flickable.VerticalFlick contentWidth: width contentHeight: notifList.implicitHeight StyledScrollBar.vertical: StyledScrollBar { flickable: view } NotifDockList { id: notifList props: root.props visibilities: root.visibilities container: view } } } Timer { id: clearTimer repeat: true triggeredOnStart: true interval: Math.max(15, Math.min(80, 69.8 - 12.3 * Math.log(Notifs.notClosed.length))) onTriggered: { const first = Notifs.notClosed[0]; if (!first) { stop(); return; } const appName = first.appName; let cleared = 0; for (const n of Notifs.notClosed.filter(n => n.appName === appName)) { n.close(); cleared++; if (cleared > 30) { interval = 5; return; } } } } Loader { asynchronous: true anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: Tokens.padding.medium scale: root.notifCount > 0 ? 1 : 0.5 opacity: root.notifCount > 0 ? 1 : 0 active: opacity > 0 sourceComponent: IconButton { id: clearBtn icon: "clear_all" radius: Tokens.rounding.large padding: Tokens.padding.medium font: Tokens.font.icon.builder.size(Math.round(Tokens.font.icon.large.pointSize * 1.2)).build() onClicked: clearTimer.start() Elevation { anchors.fill: parent radius: parent.radius z: -1 level: clearBtn.stateLayer.containsMouse ? 4 : 3 } } Behavior on scale { Anim { type: Anim.FastSpatial } } Behavior on opacity { Anim { duration: Tokens.anim.durations.expressiveFastSpatial } } } }