OPtimization: Notification History only loaded when necessary

This commit is contained in:
LemmyCook 2025-08-25 21:54:03 -04:00
parent fcedb65119
commit d2563db5a0
3 changed files with 178 additions and 176 deletions

View file

@ -12,7 +12,7 @@ import qs.Widgets
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
Loader { delegate: Loader {
required property ShellScreen modelData required property ShellScreen modelData
readonly property real scaling: ScalingService.scale(modelData) readonly property real scaling: ScalingService.scale(modelData)

View file

@ -12,12 +12,11 @@ import qs.Widgets
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
PanelWindow { delegate: Loader {
id: root id: root
required property ShellScreen modelData required property ShellScreen modelData
readonly property real scaling: ScalingService.scale(screen) readonly property real scaling: ScalingService.scale(modelData)
screen: modelData
// Access the notification model from the service // Access the notification model from the service
property ListModel notificationModel: NotificationService.notificationModel property ListModel notificationModel: NotificationService.notificationModel
@ -25,13 +24,15 @@ Variants {
// Track notifications being removed for animation // Track notifications being removed for animation
property var removingNotifications: ({}) property var removingNotifications: ({})
color: Color.transparent
// If no notification display activated in settings, then show them all // If no notification display activated in settings, then show them all
visible: modelData ? (Settings.data.notifications.monitors.includes(modelData.name) active: modelData ? (Settings.data.notifications.monitors.includes(modelData.name)
|| (Settings.data.notifications.monitors.length === 0)) || (Settings.data.notifications.monitors.length === 0))
&& (NotificationService.notificationModel.count > 0) : false && (NotificationService.notificationModel.count > 0) : false
sourceComponent: PanelWindow {
screen: modelData
color: Color.transparent
// Position based on bar location // Position based on bar location
anchors.top: Settings.data.bar.position === "top" anchors.top: Settings.data.bar.position === "top"
anchors.bottom: Settings.data.bar.position === "bottom" anchors.bottom: Settings.data.bar.position === "bottom"
@ -222,4 +223,5 @@ Variants {
} }
} }
} }
}
} }

View file

@ -77,19 +77,19 @@ NPanel {
NIcon { NIcon {
text: "notifications_off" text: "notifications_off"
font.pointSize: Style.fontSizeXXXL * scaling font.pointSize: Style.fontSizeXXXL * scaling
color: Color.mOnSurfaceVariant color: Color.mOnSurface
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
NText { NText {
text: "No notifications" text: "No notifications"
font.pointSize: Style.fontSizeL * scaling font.pointSize: Style.fontSizeL * scaling
color: Color.mOnSurfaceVariant color: Color.mOnSurface
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
NText { NText {
text: "Notifications will appear here when you receive them" text: "Your notifications will show up here as they arrive."
font.pointSize: Style.fontSizeNormal * scaling font.pointSize: Style.fontSizeNormal * scaling
color: Color.mOnSurfaceVariant color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter