From 54cd4d548e847e23661c894f2d5359564dc92fcf Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Thu, 7 Aug 2025 12:10:37 -0400 Subject: [PATCH] notifications: Ensure correct state is being set for do not disturb Change the "toggleDoNotDisturbMode" function to "setDoNotDisturbMode" and add a parameter so that we actually set the mode to the intended value, not just flip it. --- .../notifications/NotificationsWidget.qml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/components/mobileshell/qml/widgets/notifications/NotificationsWidget.qml b/components/mobileshell/qml/widgets/notifications/NotificationsWidget.qml index 41fb1773..5cca9e84 100644 --- a/components/mobileshell/qml/widgets/notifications/NotificationsWidget.qml +++ b/components/mobileshell/qml/widgets/notifications/NotificationsWidget.qml @@ -129,12 +129,21 @@ Item { } /** - * Toggles Do Not Disturb mode. + * Sets Do Not Disturb mode to the intended setting. + * Note: The state may not change to the desired setting, always read doNotDisturbEnabled for the current state. */ - function toggleDoNotDisturbMode() { - if (doNotDisturbModeEnabled) { - notificationSettings.defaults(); + function setDoNotDisturbMode(doNotDisturb: bool) { + if (!doNotDisturb) { + // Turn off do not disturb + + notificationSettings.notificationsInhibitedUntil = undefined; + notificationSettings.revokeApplicationInhibitions(); + notificationSettings.fullscreenFocused = false; + // overrules current mirrored screen setup, updates again when screen configuration changes + notificationSettings.screensMirrored = false; + } else { + // Turn on do not disturb // We just have a global toggle, so set it to a really long time (in this case, a year) var until = new Date(); until.setFullYear(until.getFullYear() + 1); @@ -157,7 +166,7 @@ Item { function onDoNotDisturbChanged() { if (root.doNotDisturbModeEnabled !== MobileShellState.ShellDBusClient.doNotDisturb) { - root.toggleDoNotDisturbMode(); + root.setDoNotDisturbMode(MobileShellState.ShellDBusClient.doNotDisturb); } } }