1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-17 19:22:04 -04:00

notifications: add configurable durations for do not disturb

fixes #1481
This commit is contained in:
bbedward
2026-04-16 16:51:05 -04:00
parent c6e8067a22
commit 7ced91ede1
18 changed files with 868 additions and 40 deletions

View File

@@ -9,12 +9,18 @@ Item {
property var keyboardController: null
property bool showSettings: false
property int currentTab: 0
property bool showDndMenu: false
onCurrentTabChanged: {
if (currentTab === 1 && !SettingsData.notificationHistoryEnabled)
currentTab = 0;
}
onShowSettingsChanged: {
if (showSettings)
showDndMenu = false;
}
Connections {
target: SettingsData
function onNotificationHistoryEnabledChanged() {
@@ -59,8 +65,31 @@ Item {
iconColor: SessionData.doNotDisturb ? Theme.error : Theme.surfaceText
buttonSize: Theme.iconSize + Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
onClicked: SessionData.setDoNotDisturb(!SessionData.doNotDisturb)
onEntered: sharedTooltip.show(I18n.tr("Do Not Disturb"), doNotDisturbButton, 0, 0, "bottom")
onClicked: {
if (SessionData.doNotDisturb) {
SessionData.setDoNotDisturb(false);
return;
}
root.showDndMenu = !root.showDndMenu;
if (root.showDndMenu)
root.showSettings = false;
}
onEntered: sharedTooltip.show(SessionData.doNotDisturb ? I18n.tr("Turn off Do Not Disturb") : I18n.tr("Do Not Disturb"), doNotDisturbButton, 0, 0, "bottom")
onExited: sharedTooltip.hide()
}
DankActionButton {
id: dndScheduleButton
iconName: root.showDndMenu ? "expand_less" : "schedule"
iconColor: root.showDndMenu ? Theme.primary : Theme.surfaceText
buttonSize: Theme.iconSize + Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
onClicked: {
root.showDndMenu = !root.showDndMenu;
if (root.showDndMenu)
root.showSettings = false;
}
onEntered: sharedTooltip.show(I18n.tr("Silence for a while"), dndScheduleButton, 0, 0, "bottom")
onExited: sharedTooltip.hide()
}
}
@@ -139,6 +168,13 @@ Item {
}
}
DndDurationMenu {
id: dndMenu
width: parent.width
visible: root.showDndMenu
onDismissed: root.showDndMenu = false
}
DankButtonGroup {
id: tabGroup
width: parent.width