diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-15 23:32:07 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-15 23:32:07 +1000 |
| commit | 172c1a047de327708a55d9c8e2efcbc09481d048 (patch) | |
| tree | d3c6782fdc8edf44922cd0a9df1b55d36502069b | |
| parent | internal: fix splitbutton expand statelayer (diff) | |
| download | caelestia-shell-172c1a047de327708a55d9c8e2efcbc09481d048.tar.gz caelestia-shell-172c1a047de327708a55d9c8e2efcbc09481d048.tar.bz2 caelestia-shell-172c1a047de327708a55d9c8e2efcbc09481d048.zip | |
utilities/toggles: add dnd
Closes #80
Closes #426
| -rw-r--r-- | modules/utilities/cards/Toggles.qml | 6 | ||||
| -rw-r--r-- | services/Notifs.qml | 34 |
2 files changed, 36 insertions, 4 deletions
diff --git a/modules/utilities/cards/Toggles.qml b/modules/utilities/cards/Toggles.qml index 15924a4..82aac95 100644 --- a/modules/utilities/cards/Toggles.qml +++ b/modules/utilities/cards/Toggles.qml @@ -78,6 +78,12 @@ StyledRect { checked: GameMode.enabled onClicked: GameMode.enabled = !GameMode.enabled } + + Toggle { + icon: "notifications_off" + checked: Notifs.dnd + onClicked: Notifs.dnd = !Notifs.dnd + } } } 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 { |