Files
osu-shell/NotificationBox.qml
2026-02-09 00:09:29 -08:00

92 lines
2.2 KiB
QML

import Quickshell
import Quickshell.Services.Notifications
import QtQuick
import QtQuick.Controls
import QtQuick.Effects
Rectangle {
id: notifRect
required property var notification
property bool exiting: false
width: parent?.width ?? 0
height: notifContent.childrenRect.height + 32
radius: 20
color: "#181818"
Image {
id: notifIcon
visible: false
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 12
}
width: 40
height: 40
source: notification?.image ?? source
layer.enabled: true
}
Rectangle {
id: iconMask
antialiasing: true
layer.enabled: true
visible: false
anchors.fill: notifIcon
layer.smooth: true
radius: 8
}
MultiEffect {
anchors.fill: notifIcon
source: notifIcon
maskEnabled: true
maskSource: iconMask
maskThresholdMin: 0.5
maskSpreadAtMin: 1
}
Column {
id: notifContent
anchors {
left: parent.left
right: parent.right
top: parent.top
topMargin: 16
leftMargin: 16 + (notifIcon.source == "" ? 0 : 44)
rightMargin: 16
}
spacing: 6
Text {
anchors {
left: parent.left
right: parent.right
}
color: "white"
font.family: "Comfortaa"
font.pixelSize: 16
text: notification?.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: notification?.body ?? text
elide: Text.ElideRight
wrapMode: Text.Wrap
maximumLineCount: 4
}
}
Timer {
running: notification?.expireTimeout > 0
interval: (notification?.expireTimeout > 0) ? notification?.expireTimeout : 0
onTriggered: notification.tracked = false
}
}