Notification backend usable
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user