Notification backend usable

This commit is contained in:
Amaro Lopes
2025-10-07 23:15:53 -03:00
parent d9406f2a90
commit 7c2c2f3a7c
13 changed files with 352 additions and 339 deletions

View File

@@ -2,16 +2,13 @@ pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Services.Notifications
import Quickshell.Widgets
import qs.Widgets
Singleton {
id: notificationRoot
readonly property var notificationServer: notificationServer
readonly property var trackedNotifications: notificationServer.trackedNotifications
readonly property var notificationsNumber: notificationServer.trackedNotifications.values.length
@@ -29,6 +26,9 @@ Singleton {
notif.dismiss();
return;
}
if (notif.traked) {
return;
}
notif.tracked = true;
notificationRoot.currentNotification = notif;
notificationRoot.shouldShowOsd = true;
@@ -47,19 +47,33 @@ Singleton {
LazyLoader {
id: popupLoader
active: currentNotification && shouldShowOsd
active: notificationRoot.currentNotification && notificationRoot.shouldShowOsd
component: NotificationPopup {
notification: currentNotification
// No signal handler here!
}
component: PanelWindow {
id: notificationWindow
onItemChanged: {
if (item) {
item.dismissed.connect(function() {
notificationRoot.shouldShowOsd = false
currentNotification.dismiss()
})
anchors.top: true
margins.top: screen.height / 100
exclusiveZone: 0
implicitWidth: 400
implicitHeight: 905
color: "transparent"
NotificationWrapper {
id: notificationWrapper
notification: notificationRoot.currentNotification
implicitWidth: notificationWindow.implicitWidth
Component.onCompleted: {
console.log(notificationWrapper.height);
popupLoader.implicitHeight = notificationWrapper.implicitHeight;
}
onDismissed: {
notificationRoot.shouldShowOsd = false;
notificationRoot.currentNotification.dismiss();
}
}
}
}