lux-shell/services/Notifications.qml
2025-08-05 08:30:58 -04:00

39 lines
871 B
QML

pragma Singleton
import Quickshell
import Quickshell.Services.Notifications
Singleton {
id: root
property bool enabled: true
property bool hasNotifications: list.length > 0
property list<Notification> list: []
function clear() {
list.forEach(notification => {
notification?.dismiss();
});
list = [];
}
NotificationServer {
id: server
keepOnReload: false
actionsSupported: true
bodyHyperlinksSupported: true
bodyImagesSupported: true
bodyMarkupSupported: true
imageSupported: true
onNotification: event => {
if (!root.enabled) {
return;
}
event.tracked = true;
root.list = root.list.filter(item => item.id != event.id);
root.list.push(event);
}
}
}