1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-17 11:12:06 -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

@@ -372,10 +372,10 @@ Popup {
anchors.fill: parent
implicitWidth: Math.max(180, menuColumn.implicitWidth + Theme.spacingS * 2)
implicitHeight: menuColumn.implicitHeight + Theme.spacingS * 2
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
color: BlurService.enabled ? Theme.surfaceContainer : Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
radius: Theme.cornerRadius
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
border.width: 1
border.color: BlurService.enabled ? BlurService.borderColor : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
border.width: BlurService.enabled ? BlurService.borderWidth : 1
Rectangle {
anchors.fill: parent
@@ -438,7 +438,7 @@ Popup {
if (root.keyboardNavigation && root.selectedMenuIndex === menuItemDelegate.itemIndex) {
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2);
}
return itemMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent";
return itemMouseArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent";
}
Row {

View File

@@ -144,10 +144,48 @@ DankModal {
return "NOTIFICATION_MODAL_TOGGLE_DND_SUCCESS";
}
function enableDoNotDisturbFor(minutes: int): string {
if (minutes <= 0) {
return "ERROR: minutes must be > 0";
}
SessionData.setDoNotDisturb(true, minutes);
return "NOTIFICATION_MODAL_DND_SET_FOR_" + minutes + "_SUCCESS";
}
function enableDoNotDisturbUntil(timestampMs: string): string {
const ts = Number(timestampMs);
if (!ts || ts <= Date.now()) {
return "ERROR: timestamp must be a future epoch ms";
}
SessionData.setDoNotDisturbUntilTimestamp(ts);
return "NOTIFICATION_MODAL_DND_SET_UNTIL_SUCCESS";
}
function enableDoNotDisturbIndefinitely(): string {
SessionData.setDoNotDisturb(true, 0);
return "NOTIFICATION_MODAL_DND_INDEFINITE_SUCCESS";
}
function enableDoNotDisturbUntilTomorrowMorning(): string {
const now = new Date();
const target = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 8, 0, 0, 0);
SessionData.setDoNotDisturbUntilTimestamp(target.getTime());
return "NOTIFICATION_MODAL_DND_UNTIL_TOMORROW_SUCCESS";
}
function disableDoNotDisturb(): string {
SessionData.setDoNotDisturb(false);
return "NOTIFICATION_MODAL_DND_DISABLE_SUCCESS";
}
function getDoNotDisturb(): bool {
return SessionData.doNotDisturb;
}
function getDoNotDisturbUntil(): string {
return String(SessionData.doNotDisturbUntil);
}
function clearAll(): string {
notificationModal.clearAll();
return "NOTIFICATION_MODAL_CLEAR_ALL_SUCCESS";