[plasma/plasma-workspace] /: applets/notifications: enable DND while fullscreen app is focused

Nate Graham <[email protected]>
Newsgroups gmane.comp.kde.cvs,gmane.comp.kde.doc
Message-ID <[email protected]>
Git commit 6d3aa1d007293fd550f178d8c39b95f5c9b3911d by Nate Graham, on behalf of Kristen McWilliam.
Committed on 23/04/2025 at 22:16.
Pushed by ngraham into branch 'master'.

applets/notifications: enable DND while fullscreen app is focused

Resolves https://invent.kde.org/plasma/plasma-workspace/-/issues/119.

There is currently a setting to allow normal-priority notifications to
appear in full-screen windows, which doesn't actually affect the DND mode.
This change replaces that setting with a more intuitive behavior: while a
full-screen window is focused, DND mode is enabled, and when the focus is
no longer on the full-screen window, DND mode is disabled. Benefits:

- Notifications appearing or not is less magic, and the user can easily
  understand why they are appearing or not.
- DND mode is actually activated when inhibiting notifications, which
  allows the rest of the system to know that the user is busy with
  something, and apps can read the `org.freedesktop.Notifications.Inhibited`
  property to check the status of DND mode.

M  +6    -0    applets/notifications/package/contents/ui/FullRepresentation.qml
M  +6    -1    applets/notifications/package/contents/ui/global/Globals.qml
M  +5    -0    doc/kcontrol/notifications/index.docbook
M  +11   -13   kcms/notifications/ui/main.qml
M  +4    -0    libnotificationmanager/CMakeLists.txt
A  +61   -0    libnotificationmanager/fullscreentracker.cpp     [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)]
A  +45   -0    libnotificationmanager/fullscreentracker_p.h     [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)]
M  +4    -0    libnotificationmanager/kcfg/donotdisturbsettings.kcfg
M  +0    -3    libnotificationmanager/kcfg/notificationsettings.kcfg
A  +8    -0    libnotificationmanager/kconf_update/CMakeLists.txt
A  +51   -0    libnotificationmanager/kconf_update/plasma6.4-migrate-fullscreen-notifications-to-dnd.cpp     [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)]
A  +7    -0    libnotificationmanager/kconf_update/plasma6.4-migrate-fullscreen-notifications-to-dnd.upd
M  +56   -14   libnotificationmanager/settings.cpp
M  +29   -7    libnotificationmanager/settings.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/6d3aa1d007293fd550f178d8c39b95f5c9b3911d

diff --git a/applets/notifications/package/contents/ui/FullRepresentation.qml b/applets/notifications/package/contents/ui/FullRepresentation.qml
index 060c6c48e6f..18707ed5a2e 100644
--- a/applets/notifications/package/contents/ui/FullRepresentation.qml
+++ b/applets/notifications/package/contents/ui/FullRepresentation.qml
@@ -202,6 +202,8 @@ PlasmaExtras.Representation {
                     var inhibitedByApp = notificationSettings.notificationsInhibitedByApplication;
                     var inhibitedByMirroredScreens = notificationSettings.inhibitNotificationsWhenScreensMirrored
                                                         && notificationSettings.screensMirrored;
+                    var inhibitedByFullscreen = notificationSettings.inhibitNotificationsWhenFullscreen
+                                                        && notificationSettings.fullscreenFocused;
                     var dateNow = Date.now();
 
                     var sections = [];
@@ -234,6 +236,10 @@ PlasmaExtras.Representation {
                         sections.push(i18nc("Do not disturb because external mirrored screens connected", "Screens are mirrored"))
                     }
 
+                    if (inhibitedByFullscreen) {
+                        sections.push(i18nc("Do not disturb because fullscreen app is focused", "Fullscreen app is focused"))
+                    }
+
                     return sections.join(" · ");
                 }
                 visible: text !== ""
diff --git a/applets/notifications/package/contents/ui/global/Globals.qml b/applets/notifications/package/contents/ui/global/Globals.qml
index 7b4ce363936..1bec4b56284 100644
--- a/applets/notifications/package/contents/ui/global/Globals.qml
+++ b/applets/notifications/package/contents/ui/global/Globals.qml
@@ -277,6 +277,10 @@ QtObject {
                 inhibited |= true;
             }
 
+            if (notificationSettings.inhibitNotificationsWhenFullscreen) {
+                inhibited |= notificationSettings.fullscreenFocused;
+            }
+
             if (notificationSettings.inhibitNotificationsWhenScreensMirrored) {
                 inhibited |= notificationSettings.screensMirrored;
             }
@@ -288,6 +292,7 @@ QtObject {
     function revokeInhibitions() {
         notificationSettings.notificationsInhibitedUntil = undefined;
         notificationSettings.revokeApplicationInhibitions();
+        notificationSettings.fullscreenFocused = false;
         // overrules current mirrored screen setup, updates again when screen configuration changes
         notificationSettings.screensMirrored = false;
 
@@ -477,7 +482,7 @@ QtObject {
 
             popupWidth: globals.popupWidth
 
-            isCritical: model.urgency === NotificationManager.Notifications.CriticalUrgency || (model.urgency === NotificationManager.Notifications.NormalUrgency && notificationSettings.keepNormalAlwaysOnTop)
+            isCritical: model.urgency === NotificationManager.Notifications.CriticalUrgency || (model.urgency === NotificationManager.Notifications.NormalUrgency && !notificationSettings.inhibitNotificationsWhenFullscreen)
 
             modelTimeout: model.timeout
             // Increase default timeout for notifications with a URL so you have enough time
diff --git a/doc/kcontrol/notifications/index.docbook b/doc/kcontrol/notifications/index.docbook
index c82f223777a..efd7f56c117 100644
--- a/doc/kcontrol/notifications/index.docbook
+++ b/doc/kcontrol/notifications/index.docbook
@@ -57,6 +57,11 @@ each event.</para>
     <listitem><para>Automatically enable do not disturb mode when you share your screens, for example during an online lecture.</para></listitem>
     </varlistentry>
 
+    <varlistentry>
+    <term><guiicon>Enable while a fullscreen application is focused</guiicon></term>
+    <listitem><para>Automatically enable do not disturb mode while you are using a fullscreen application, for example watching a video.</para></listitem>
+    </varlistentry>
+
     <varlistentry>
     <term><guiicon>Show critical notifications</guiicon></term>
     <listitem><para>Whether to show critical notifications, such as your battery is almost empty, to show even when in do not disturb mode.</para></listitem>
diff --git a/kcms/notifications/ui/main.qml b/kcms/notifications/ui/main.qml
index fd34a88c03f..c661b78a5d2 100644
--- a/kcms/notifications/ui/main.qml
+++ b/kcms/notifications/ui/main.qml
@@ -133,6 +133,17 @@ KCM.SimpleKCM {
             }
         }
 
+        QtControls.CheckBox {
+            text: i18nc("Automatically enable Do Not Disturb mode while a fullscreen application is focused", "While a fullscreen application is focused")
+            checked: kcm.dndSettings.whenFullscreen
+            onClicked: kcm.dndSettings.whenFullscreen = checked
+
+            KCM.SettingStateBinding {
+                configObject: kcm.dndSettings
+                settingName: "WhenFullscreen"
+                extraEnabledConditions: root.notificationsAvailable
+            }
+        }
 
         KQuickControls.KeySequenceItem {
             Kirigami.FormData.label: i18nc("Keyboard shortcut to turn Do Not Disturb mode on and off", "Manually toggle with shortcut:")
@@ -159,19 +170,6 @@ KCM.SimpleKCM {
             }
         }
 
-        QtControls.CheckBox {
-            Kirigami.FormData.label: i18n("Normal notifications:")
-            text: i18n("Show over full screen windows")
-            checked: kcm.notificationSettings.normalAlwaysOnTop
-            onClicked: kcm.notificationSettings.normalAlwaysOnTop = checked
-
-            KCM.SettingStateBinding {
-                configObject: kcm.notificationSettings
-                settingName: "NormalAlwaysOnTop"
-                extraEnabledConditions: root.notificationsAvailable
-            }
-        }
-
         QtControls.CheckBox {
             Kirigami.FormData.label: i18n("Low priority notifications:")
             text: i18n("Show popup")
diff --git a/libnotificationmanager/CMakeLists.txt b/libnotificationmanager/CMakeLists.txt
index 6d26cf015b4..0121827ecb9 100644
--- a/libnotificationmanager/CMakeLists.txt
+++ b/libnotificationmanager/CMakeLists.txt
@@ -10,6 +10,7 @@ set(notificationmanager_LIB_SRCS
     serverinfo.cpp
     settings.cpp
     mirroredscreenstracker.cpp
+    fullscreentracker.cpp
     notifications.cpp
     notification.cpp
 
@@ -87,6 +88,7 @@ target_link_libraries(notificationmanager
         KF6::Notifications # Inhibition summary
         KF6::KIOFileWidgets
         Plasma::Plasma
+        PW::LibTaskManager
         KF6::Screen
         KF6::Service
         Canberra::Canberra
@@ -140,3 +142,5 @@ install(FILES plasmanotifyrc
 
 install(FILES libnotificationmanager.notifyrc
     DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})
+
+add_subdirectory(kconf_update)
diff --git a/libnotificationmanager/fullscreentracker.cpp b/libnotificationmanager/fullscreentracker.cpp
new file mode 100644
index 00000000000..b5757ef3a10
--- /dev/null
+++ b/libnotificationmanager/fullscreentracker.cpp
@@ -0,0 +1,61 @@
+/*
+    SPDX-FileCopyrightText: 2024 Kristen McWilliam <[email protected]>
+
+    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
+*/
+
+#include "abstracttasksmodel.h"
+#include "fullscreentracker_p.h"
+
+using namespace NotificationManager;
+
+FullscreenTracker::FullscreenTracker(QObject *parent)
+    : TaskManager::TasksModel(parent)
+{
+    setFilterMinimized(true);
+    setFilterHidden(true);
+
+    checkFullscreenFocused();
+
+    connect(this, &TaskManager::TasksModel::activeTaskChanged, this, &FullscreenTracker::checkFullscreenFocused);
+    connect(this, &TaskManager::TasksModel::dataChanged, this, &FullscreenTracker::checkFullscreenFocused);
+}
+
+FullscreenTracker::~FullscreenTracker() = default;
+
+FullscreenTracker::Ptr FullscreenTracker::createTracker()
+{
+    static std::weak_ptr<FullscreenTracker> s_instance;
+    if (s_instance.expired()) {
+        std::shared_ptr<FullscreenTracker> ptr(new FullscreenTracker(nullptr));
+        s_instance = ptr;
+        return ptr;
+    }
+    return s_instance.lock();
+}
+
+bool FullscreenTracker::fullscreenFocused() const
+{
+    return m_fullscreenFocused;
+}
+
+void FullscreenTracker::setFullscreenFocused(bool focused)
+{
+    if (m_fullscreenFocused != focused) {
+        m_fullscreenFocused = focused;
+        Q_EMIT fullscreenFocusedChanged(focused);
+    }
+}
+
+void FullscreenTracker::checkFullscreenFocused()
+{
+    QModelIndex activeTaskIndex = activeTask();
+    if (!activeTaskIndex.isValid()) {
+        setFullscreenFocused(false);
+        return;
+    }
+
+    bool isFullscreen = activeTaskIndex.data(TaskManager::AbstractTasksModel::IsFullScreen).toBool();
+
+    setFullscreenFocused(isFullscreen);
+}
diff --git a/libnotificationmanager/fullscreentracker_p.h b/libnotificationmanager/fullscreentracker_p.h
new file mode 100644
index 00000000000..77e080dffde
--- /dev/null
+++ b/libnotificationmanager/fullscreentracker_p.h
@@ -0,0 +1,45 @@
+/*
+    SPDX-FileCopyrightText: 2024 Kristen McWilliam <[email protected]>
+
+    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
+*/
+
+#pragma once
+
+#include <QObject>
+
+#include <tasksmodel.h>
+
+namespace NotificationManager
+{
+
+/**
+ * Tracks whether a fullscreen window is focused.
+ *
+ * It is used to determine whether to automatically enable Do Not Disturb mode when a fullscreen window is focused.
+ *
+ **/
+class FullscreenTracker : public TaskManager::TasksModel
+{
+    Q_OBJECT
+
+public:
+    FullscreenTracker(QObject *parent = nullptr);
+    ~FullscreenTracker() override;
+
+    using Ptr = std::shared_ptr<FullscreenTracker>;
+    static Ptr createTracker();
+
+    bool fullscreenFocused() const;
+    void setFullscreenFocused(bool focused);
+    Q_SIGNAL void fullscreenFocusedChanged(bool focused);
+
+private:
+    FullscreenTracker();
+    Q_DISABLE_COPY(FullscreenTracker)
+
+    void checkFullscreenFocused();
+    bool m_fullscreenFocused = false;
+};
+
+}
diff --git a/libnotificationmanager/kcfg/donotdisturbsettings.kcfg b/libnotificationmanager/kcfg/donotdisturbsettings.kcfg
index 0e15d632c03..dcc7a44fccc 100644
--- a/libnotificationmanager/kcfg/donotdisturbsettings.kcfg
+++ b/libnotificationmanager/kcfg/donotdisturbsettings.kcfg
@@ -18,6 +18,10 @@
             <default>true</default>
         </entry>
 
+        <entry name="WhenFullscreen" type="Bool">
+            <default>true</default>
+        </entry>
+
         <entry name="NotificationSoundsMuted" type="Bool">
             <default>false</default>
         </entry>
diff --git a/libnotificationmanager/kcfg/notificationsettings.kcfg b/libnotificationmanager/kcfg/notificationsettings.kcfg
index bd29d2927b5..d9c6b0afd81 100644
--- a/libnotificationmanager/kcfg/notificationsettings.kcfg
+++ b/libnotificationmanager/kcfg/notificationsettings.kcfg
@@ -9,9 +9,6 @@
         <entry name="CriticalInDndMode" type="Bool">
             <default>true</default>
         </entry>
-        <entry name="NormalAlwaysOnTop" type="Bool">
-            <default>false</default>
-        </entry>
         <entry name="LowPriorityPopups" type="Bool">
             <default>true</default>
         </entry>
diff --git a/libnotificationmanager/kconf_update/CMakeLists.txt b/libnotificationmanager/kconf_update/CMakeLists.txt
new file mode 100644
index 00000000000..235b188f5c1
--- /dev/null
+++ b/libnotificationmanager/kconf_update/CMakeLists.txt
@@ -0,0 +1,8 @@
+# SPDX-FileCopyrightText: 2025 Kristen McWilliam <[email protected]>
+# SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
+
+add_executable(plasma6.4-migrate-fullscreen-notifications-to-dnd)
+target_sources(plasma6.4-migrate-fullscreen-notifications-to-dnd PRIVATE plasma6.4-migrate-fullscreen-notifications-to-dnd.cpp)
+target_link_libraries(plasma6.4-migrate-fullscreen-notifications-to-dnd PRIVATE KF6::ConfigCore Qt::Core)
+install(FILES plasma6.4-migrate-fullscreen-notifications-to-dnd.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
+install(TARGETS plasma6.4-migrate-fullscreen-notifications-to-dnd DESTINATION ${KDE_INSTALL_LIBDIR}/kconf_update_bin/)
diff --git a/libnotificationmanager/kconf_update/plasma6.4-migrate-fullscreen-notifications-to-dnd.cpp b/libnotificationmanager/kconf_update/plasma6.4-migrate-fullscreen-notifications-to-dnd.cpp
new file mode 100644
index 00000000000..498e465dfb5
--- /dev/null
+++ b/libnotificationmanager/kconf_update/plasma6.4-migrate-fullscreen-notifications-to-dnd.cpp
@@ -0,0 +1,51 @@
+/*
+    SPDX-FileCopyrightText: 2025 Kristen McWilliam <[email protected]>
+
+    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
+*/
+
+#include <iostream>
+
+#include <KConfigGroup>
+#include <KSharedConfig>
+
+#include <QStringLiteral>
+
+/**
+ * If the user has enabled the "Show over full screen windows" option,
+ * this script will migrate that preference by setting the new
+ * "Do Not Disturb when full screen windows are present" false.
+ *
+ * @since 6.4
+ */
+int main()
+{
+    const KSharedConfigPtr configPtr = KSharedConfig::openConfig(QStringLiteral("plasmanotifyrc"), KConfig::SimpleConfig);
+    KConfigGroup notificationsGroup(configPtr, QStringLiteral("Notifications"));
+    if (!notificationsGroup.exists()) {
+        std::cout << "plasmanotifyrc doesn't have a Notifications group. No need to update config." << std::endl;
+        return EXIT_SUCCESS;
+    }
+
+    // Check if the legacy "Show over full screen windows" option is enabled.
+    bool showOverFullScreen = notificationsGroup.readEntry("NormalAlwaysOnTop", false);
+    if (!showOverFullScreen) {
+        std::cout << "The 'Show over full screen windows' option is not enabled. No need to update config." << std::endl;
+        return EXIT_SUCCESS;
+    }
+
+    // Remove the old setting.
+    notificationsGroup.deleteEntry("NormalAlwaysOnTop");
+
+    // Disable the new setting to preserve the old behavior.
+    KConfigGroup dndGroup(configPtr, QStringLiteral("DoNotDisturb"));
+    dndGroup.writeEntry("WhenFullscreen", false);
+
+    // Save the changes to the configuration file.
+    if (!configPtr->sync()) {
+        std::cerr << "Failed to save changes to plasmanotifyrc." << std::endl;
+        return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}
diff --git a/libnotificationmanager/kconf_update/plasma6.4-migrate-fullscreen-notifications-to-dnd.upd b/libnotificationmanager/kconf_update/plasma6.4-migrate-fullscreen-notifications-to-dnd.upd
new file mode 100644
index 00000000000..6783efb9979
--- /dev/null
+++ b/libnotificationmanager/kconf_update/plasma6.4-migrate-fullscreen-notifications-to-dnd.upd
@@ -0,0 +1,7 @@
+# SPDX-FileCopyrightText: 2025 Kristen McWilliam <[email protected]>
+# SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
+
+Version=6
+
+Id=plasma6.4-migrate-fullscreen-notifications-to-dnd
+Script=plasma6.4-migrate-fullscreen-notifications-to-dnd
diff --git a/libnotificationmanager/settings.cpp b/libnotificationmanager/settings.cpp
index 84991dfd607..94fb0ada813 100644
--- a/libnotificationmanager/settings.cpp
+++ b/libnotificationmanager/settings.cpp
@@ -1,5 +1,6 @@
 /*
     SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <[email protected]>
+    SPDX-FileCopyrightText: 2024 Kristen McWilliam <[email protected]>
 
     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
 */
@@ -12,6 +13,7 @@
 #include <KService>
 
 #include "debug.h"
+#include "fullscreentracker_p.h"
 #include "mirroredscreenstracker_p.h"
 #include "server.h"
 
@@ -47,6 +49,7 @@ public:
     KConfigWatcher::Ptr watcher;
     QMetaObject::Connection watcherConnection;
 
+    FullscreenTracker::Ptr fullscreenTracker;
     MirroredScreensTracker::Ptr mirroredScreensTracker;
 
     DoNotDisturbSettings dndSettings;
@@ -156,6 +159,11 @@ Settings::Settings(QObject *parent)
     connect(&Server::self(), &Server::inhibitedByApplicationChanged, this, &Settings::notificationsInhibitedByApplicationChanged);
     connect(&Server::self(), &Server::inhibitionApplicationsChanged, this, &Settings::notificationInhibitionApplicationsChanged);
 
+    if (d->dndSettings.whenFullscreen()) {
+        d->fullscreenTracker = FullscreenTracker::createTracker();
+        connect(d->fullscreenTracker.get(), &FullscreenTracker::fullscreenFocusedChanged, this, &Settings::fullscreenFocusedChanged);
+    }
+
     if (d->dndSettings.whenScreensMirrored()) {
         d->mirroredScreensTracker = MirroredScreensTracker::createTracker();
         connect(d->mirroredScreensTracker.get(), &MirroredScreensTracker::screensMirroredChanged, this, &Settings::screensMirroredChanged);
@@ -303,6 +311,22 @@ void Settings::setLive(bool live)
                 if (emitScreensMirroredChanged) {
                     Q_EMIT screensMirroredChanged();
                 }
+
+                bool emitFullscreenChanged = false;
+                if (d->dndSettings.whenFullscreen()) {
+                    if (!d->fullscreenTracker) {
+                        d->fullscreenTracker = FullscreenTracker::createTracker();
+                        emitFullscreenChanged = d->fullscreenTracker->fullscreenFocused();
+                        connect(d->fullscreenTracker.get(), &FullscreenTracker::fullscreenFocusedChanged, this, &Settings::fullscreenFocusedChanged);
+                    }
+                } else if (d->fullscreenTracker) {
+                    emitFullscreenChanged = d->fullscreenTracker->fullscreenFocused();
+                    d->fullscreenTracker.reset();
+                }
+
+                if (emitFullscreenChanged) {
+                    Q_EMIT fullscreenFocusedChanged();
+                }
             } else if (group.name() == QLatin1String("Notifications")) {
                 d->notificationSettings.load();
             } else if (group.name() == QLatin1String("Jobs")) {
@@ -343,20 +367,6 @@ void Settings::setCriticalPopupsInDoNotDisturbMode(bool enable)
     d->setDirty(true);
 }
 
-bool Settings::keepNormalAlwaysOnTop() const
-{
-    return d->notificationSettings.normalAlwaysOnTop();
-}
-
-void Settings::setKeepNormalAlwaysOnTop(bool enable)
-{
-    if (this->keepNormalAlwaysOnTop() == enable) {
-        return;
-    }
-    d->notificationSettings.setNormalAlwaysOnTop(enable);
-    d->setDirty(true);
-}
-
 bool Settings::lowPriorityPopups() const
 {
     return d->notificationSettings.lowPriorityPopups();
@@ -577,6 +587,38 @@ void Settings::setInhibitNotificationsWhenScreenSharing(bool inhibit)
     d->setDirty(true);
 }
 
+bool Settings::inhibitNotificationsWhenFullscreen() const
+{
+    return d->dndSettings.whenFullscreen();
+}
+
+void Settings::setInhibitNotificationsWhenFullscreen(bool inhibit)
+{
+    if (inhibit == inhibitNotificationsWhenFullscreen()) {
+        return;
+    }
+
+    d->dndSettings.setWhenFullscreen(inhibit);
+    d->setDirty(true);
+}
+
+bool Settings::fullscreenFocused() const
+{
+    return d->fullscreenTracker && d->fullscreenTracker->fullscreenFocused();
+}
+
+void Settings::setFullscreenFocused(bool focused)
+{
+    if (focused) {
+        qCWarning(NOTIFICATIONMANAGER) << "Cannot forcefully set fullscreen focused";
+        return;
+    }
+
+    if (d->fullscreenTracker) {
+        d->fullscreenTracker->setFullscreenFocused(focused);
+    }
+}
+
 void Settings::revokeApplicationInhibitions()
 {
     Server::self().clearInhibitions();
diff --git a/libnotificationmanager/settings.h b/libnotificationmanager/settings.h
index 19f5b940e66..dd9f9ab16e6 100644
--- a/libnotificationmanager/settings.h
+++ b/libnotificationmanager/settings.h
@@ -1,5 +1,6 @@
 /*
     SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <[email protected]>
+    SPDX-FileCopyrightText: 2024 Kristen McWilliam <[email protected]>
 
     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
 */
@@ -40,10 +41,6 @@ class NOTIFICATIONMANAGER_EXPORT Settings : public QObject
      * Whether to show critical notification popups in do not disturb mode.
      */
     Q_PROPERTY(bool criticalPopupsInDoNotDisturbMode READ criticalPopupsInDoNotDisturbMode WRITE setCriticalPopupsInDoNotDisturbMode NOTIFY settingsChanged)
-    /**
-     * Whether to keep normal notifications always on top.
-     */
-    Q_PROPERTY(bool keepNormalAlwaysOnTop READ keepNormalAlwaysOnTop WRITE setKeepNormalAlwaysOnTop NOTIFY settingsChanged)
     /**
      * Whether to show popups for low priority notifications.
      */
@@ -168,6 +165,26 @@ class NOTIFICATIONMANAGER_EXPORT Settings : public QObject
     Q_PROPERTY(bool inhibitNotificationsWhenScreenSharing READ inhibitNotificationsWhenScreenSharing WRITE setInhibitNotificationsWhenScreenSharing NOTIFY
                    settingsChanged)
 
+    /**
+     * Whether to enable do not disturb mode when a fullscreen window is focused
+     *
+     * @since 6.4
+     */
+    Q_PROPERTY(
+        bool inhibitNotificationsWhenFullscreen READ inhibitNotificationsWhenFullscreen WRITE setInhibitNotificationsWhenFullscreen NOTIFY settingsChanged)
+
+    /**
+     * Whether a fullscreen window is currently focused
+     *
+     * This property is only updated when @c inhibitNotificationsWhenFullscreen
+     * is set to true, otherwise it is always false.
+     * You can assign false to this property if you want to temporarily revoke automatic do not disturb
+     * mode when a fullscreen window is focused until the window is no longer fullscreen.
+     *
+     * @since 6.4
+     */
+    Q_PROPERTY(bool fullscreenFocused READ fullscreenFocused WRITE setFullscreenFocused NOTIFY fullscreenFocusedChanged)
+
     /**
      * Whether notification sounds should be disabled
      *
@@ -249,9 +266,6 @@ public:
     bool criticalPopupsInDoNotDisturbMode() const;
     void setCriticalPopupsInDoNotDisturbMode(bool enable);
 
-    bool keepNormalAlwaysOnTop() const;
-    void setKeepNormalAlwaysOnTop(bool enable);
-
     bool lowPriorityPopups() const;
     void setLowPriorityPopups(bool enable);
 
@@ -304,6 +318,12 @@ public:
     bool inhibitNotificationsWhenScreenSharing() const;
     void setInhibitNotificationsWhenScreenSharing(bool inhibit);
 
+    bool inhibitNotificationsWhenFullscreen() const;
+    void setInhibitNotificationsWhenFullscreen(bool inhibit);
+
+    bool fullscreenFocused() const;
+    void setFullscreenFocused(bool focused);
+
     bool notificationSoundsInhibited() const;
     void setNotificationSoundsInhibited(bool inhibited);
 
@@ -328,6 +348,8 @@ Q_SIGNALS:
 
     void screensMirroredChanged();
 
+    void fullscreenFocusedChanged();
+
 private:
     class Private;
     std::unique_ptr<Private> d;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.