fix notif popup not showing

This commit is contained in:
end-4
2025-05-22 15:44:28 +02:00
parent 3e39fc7b13
commit ecbb72390a
3 changed files with 86 additions and 92 deletions
@@ -12,8 +12,6 @@ import Quickshell.Hyprland
Scope { Scope {
id: notificationPopup id: notificationPopup
LazyLoader {
loading: true
PanelWindow { PanelWindow {
id: root id: root
visible: (Notifications.popupList.length > 0) visible: (Notifications.popupList.length > 0)
@@ -105,8 +103,5 @@ Scope {
notificationObject: modelData notificationObject: modelData
} }
} }
} }
} }
}
@@ -180,7 +180,6 @@ Scope { // Scope
function toggle(): void { function toggle(): void {
sidebarLoader.active = !sidebarLoader.active sidebarLoader.active = !sidebarLoader.active
if(sidebarLoader.active) Notifications.timeoutAll();
} }
function close(): void { function close(): void {
@@ -189,7 +188,6 @@ Scope { // Scope
function open(): void { function open(): void {
sidebarLoader.active = true sidebarLoader.active = true
if(sidebarLoader.active) Notifications.timeoutAll();
} }
} }
@@ -199,7 +197,6 @@ Scope { // Scope
onPressed: { onPressed: {
sidebarLoader.active = !sidebarLoader.active; sidebarLoader.active = !sidebarLoader.active;
if(sidebarLoader.active) Notifications.timeoutAll();
} }
} }
@@ -209,7 +206,6 @@ Scope { // Scope
onPressed: { onPressed: {
sidebarLoader.active = true; sidebarLoader.active = true;
if(sidebarLoader.active) Notifications.timeoutAll();
} }
} }
@@ -2,6 +2,7 @@ pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import "root:/modules/common" import "root:/modules/common"
import "root:/"
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
@@ -13,6 +14,7 @@ Singleton {
property var filePath: `${XdgDirectories.cache}/notifications/notifications.json` property var filePath: `${XdgDirectories.cache}/notifications/notifications.json`
property var list: [] property var list: []
property var popupList: [] property var popupList: []
property bool popupInhibited: GlobalStates?.sidebarRightOpen ?? false
// Quickshell's notification IDs starts at 1 on each run, while saved notifications // Quickshell's notification IDs starts at 1 on each run, while saved notifications
// can already contain higher IDs. This is for avoiding id collisions // can already contain higher IDs. This is for avoiding id collisions
property int idOffset property int idOffset
@@ -54,7 +56,8 @@ Singleton {
"urgency": notification.urgency.toString(), "urgency": notification.urgency.toString(),
} }
root.list = [...root.list, newNotifObject]; root.list = [...root.list, newNotifObject];
root.popupList = [...root.popupList, newNotifObject]; // console.log(root.popupInhibited)
if (!root.popupInhibited) root.popupList = [...root.popupList, newNotifObject];
root.notify(newNotifObject); root.notify(newNotifObject);
notifFileView.setText(JSON.stringify(root.list, null, 2)) notifFileView.setText(JSON.stringify(root.list, null, 2))
} }