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>
This commit is contained in:
kyte 2021-11-27 13:20:23 +05:30 committed by Florian Müllner
parent 00e5f40ddd
commit 920714008c

View File

@ -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) {