summaryrefslogtreecommitdiff
path: root/services/Notifs.qml
diff options
context:
space:
mode:
Diffstat (limited to 'services/Notifs.qml')
-rw-r--r--services/Notifs.qml34
1 files changed, 30 insertions, 4 deletions
diff --git a/services/Notifs.qml b/services/Notifs.qml
index 87ecca5..46b13a5 100644
--- a/services/Notifs.qml
+++ b/services/Notifs.qml
@@ -13,6 +13,15 @@ Singleton {
readonly property list<Notif> list: []
readonly property list<Notif> popups: list.filter(n => n.popup)
+ property alias dnd: props.dnd
+
+ PersistentProperties {
+ id: props
+
+ property bool dnd
+
+ reloadableId: "notifs"
+ }
NotificationServer {
id: server
@@ -27,10 +36,11 @@ Singleton {
onNotification: notif => {
notif.tracked = true;
- root.list.push(notifComp.createObject(root, {
- popup: true,
- notification: notif
- }));
+ if (!props.dnd)
+ root.list.push(notifComp.createObject(root, {
+ popup: true,
+ notification: notif
+ }));
}
}
@@ -50,6 +60,22 @@ Singleton {
for (const notif of root.list)
notif.popup = false;
}
+
+ function isDndEnabled(): bool {
+ return props.dnd;
+ }
+
+ function toggleDnd(): void {
+ props.dnd = !props.dnd;
+ }
+
+ function enableDnd(): void {
+ props.dnd = true;
+ }
+
+ function disableDnd(): void {
+ props.dnd = false;
+ }
}
component Notif: QtObject {