[gnome-shell] lockScreen: Don't wake up screen in DND mode



commit 920714008c1eb04e5d757de6c249c57defbd8fa3
Author: kyte <kyteinsky gmail com>
Date:   Sat Nov 27 13:20:23 2021 +0530

    lockScreen: Don't wake up screen in DND mode
    
    Screen woke up whenever a new notification popped up
    on lock screen even when DND was turned on.
    This commit changes this behaviour to not wake
    the screen up in such case.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4710
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2051>

 js/ui/unlockDialog.js | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 3ef6aa90f0..367117bfd5 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -46,6 +46,10 @@ var NotificationsBox = GObject.registerClass({
 
         this.add_child(this._scrollView);
 
+        this._settings = new Gio.Settings({
+            schema_id: 'org.gnome.desktop.notifications',
+        });
+
         this._sources = new Map();
         Main.messageTray.getSources().forEach(source => {
             this._sourceAdded(Main.messageTray, source, true);
@@ -176,6 +180,14 @@ var NotificationsBox = GObject.registerClass({
         this._updateSourceBoxStyle(source, obj, box);
     }
 
+    _wakeUpScreenForSource(source) {
+        if (!this._settings.get_boolean('show-banners'))
+            return;
+        const obj = this._sources.get(source);
+        if (obj?.sourceBox.visible)
+            this.emit('wake-up-screen');
+    }
+
     _sourceAdded(tray, source, initial) {
         let obj = {
             visible: source.policy.showInLockScreen,
@@ -235,8 +247,7 @@ var NotificationsBox = GObject.registerClass({
             });
 
             this._updateVisibility();
-            if (obj.sourceBox.visible)
-                this.emit('wake-up-screen');
+            this._wakeUpScreenForSource(source);
         }
     }
 
@@ -268,8 +279,7 @@ var NotificationsBox = GObject.registerClass({
         obj.sourceBox.visible = obj.visible && (source.unseenCount > 0);
 
         this._updateVisibility();
-        if (obj.sourceBox.visible)
-            this.emit('wake-up-screen');
+        this._wakeUpScreenForSource(source);
     }
 
     _visibleChanged(source, obj) {
@@ -280,8 +290,7 @@ var NotificationsBox = GObject.registerClass({
         obj.sourceBox.visible = obj.visible && source.unseenCount > 0;
 
         this._updateVisibility();
-        if (obj.sourceBox.visible)
-            this.emit('wake-up-screen');
+        this._wakeUpScreenForSource(source);
     }
 
     _detailedChanged(source, obj) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]