Notification: add DND option to widget and notification panel as requested in #212

This commit is contained in:
Ly-sec 2025-09-05 22:42:40 +02:00
parent 60950fb461
commit c8a056f332
4 changed files with 28 additions and 5 deletions

View file

@ -14,11 +14,20 @@ NIconButton {
property real scaling: 1.0
sizeRatio: 0.8
icon: "notifications"
tooltipText: "Notification history"
icon: Settings.data.notifications.doNotDisturb ? "notifications_off" : "notifications"
tooltipText: Settings.data.notifications.doNotDisturb ? "Notification history (Do Not Disturb ON)\nRight-click to toggle Do Not Disturb" : "Notification history\nRight-click to toggle Do Not Disturb"
colorBg: Color.mSurfaceVariant
colorFg: Color.mOnSurface
colorFg: Settings.data.notifications.doNotDisturb ? Color.mError : Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
onClicked: PanelService.getPanel("notificationHistoryPanel")?.toggle(screen, this)
onRightClicked: {
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
ToastService.showNotice(
Settings.data.notifications.doNotDisturb ? "Do Not Disturb enabled" : "Do Not Disturb disabled",
Settings.data.notifications.doNotDisturb ? "Notifications will be hidden but saved to history" : "Notifications will be shown normally",
"notice", false, 2000)
}
}