notification popups

This commit is contained in:
end-4
2025-04-21 23:29:31 +02:00
parent 5dc0dc133d
commit 54fdf043c9
12 changed files with 240 additions and 46 deletions
@@ -1,6 +1,7 @@
import "root:/"
import "root:/services"
import "root:/modules/common"
import "root:/modules/common/widgets"
import "root:/services"
import "./quickToggles/"
import QtQuick
import QtQuick.Controls
@@ -25,6 +26,10 @@ Scope {
visible: false
focusable: true
onVisibleChanged: {
GlobalStates.sidebarRightOpenCount += visible ? 1 : -1
}
property var modelData
screen: modelData
@@ -191,6 +196,7 @@ Scope {
let panelWindow = sidebarVariants.instances[i];
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
panelWindow.visible = !panelWindow.visible;
if(panelWindow.visible) Notifications.timeoutAll();
}
}
}
@@ -209,6 +215,7 @@ Scope {
let panelWindow = sidebarVariants.instances[i];
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
panelWindow.visible = true;
if(panelWindow.visible) Notifications.timeoutAll();
}
}
}
@@ -22,6 +22,7 @@ Item {
notificationWidgetList.push(notif)
})
}
function onNotify(notification) {
// notificationRepeater.model = [notification, ...notificationRepeater.model]
const notif = root.notifComponent.createObject(columnLayout, { notificationObject: notification });
@@ -41,6 +42,7 @@ Item {
}
}
}
function onDiscard(id) {
for (let i = notificationWidgetList.length - 1; i >= 0; i--) {
const widget = notificationWidgetList[i];
@@ -50,6 +52,16 @@ Item {
}
}
}
function onDiscardAll() {
for (let i = notificationWidgetList.length - 1; i >= 0; i--) {
const widget = notificationWidgetList[i];
if (widget && widget.notificationObject) {
widget.destroyWithAnimation();
}
}
notificationWidgetList = [];
}
}
Flickable { // Scrollable window
@@ -145,15 +157,7 @@ Item {
buttonIcon: "clear_all"
buttonText: "Clear"
onClicked: () => {
for (let i = notificationWidgetList.length - 1; i >= 0; i--) {
// for (let i = 0; i < notificationWidgetList.length; i++) {
const widget = notificationWidgetList[i];
if (widget && widget.notificationObject) {
widget.destroyWithAnimation();
}
}
notificationWidgetList = [];
Notifications.discardAll()
Notifications.discardAllNotifications()
}
}
}