unlockDialog: Add .critical CSS class to critical notifications

As per the latest lock screen mockups, critical notifications must have
a more prominent, solid color.

Add a .critical style class to critical notification bubbles, and make
them darker.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872
This commit is contained in:
Georges Basile Stavracas Neto 2020-02-05 11:58:57 -03:00 committed by Florian Müllner
parent 893bde0ca1
commit 2644f62318
2 changed files with 19 additions and 0 deletions

View File

@ -35,6 +35,8 @@
background-color: transparentize($osd_bg_color,0.5); background-color: transparentize($osd_bg_color,0.5);
color: $osd_fg_color; color: $osd_fg_color;
border-radius: 4px; border-radius: 4px;
&.critical { background-color: transparentize($osd_bg_color,0.1) }
} }
} }

View File

@ -145,6 +145,20 @@ var NotificationsBox = GObject.registerClass({
source.narrowestPrivacyScope === MessageTray.PrivacyScope.SYSTEM; source.narrowestPrivacyScope === MessageTray.PrivacyScope.SYSTEM;
} }
_updateSourceBoxStyle(source, obj, box) {
let hasCriticalNotification =
source.notifications.some(n => n.urgency === MessageTray.Urgency.CRITICAL);
if (hasCriticalNotification !== obj.hasCriticalNotification) {
obj.hasCriticalNotification = hasCriticalNotification;
if (hasCriticalNotification)
box.add_style_class_name('critical');
else
box.remove_style_class_name('critical');
}
}
_showSource(source, obj, box) { _showSource(source, obj, box) {
if (obj.detailed) if (obj.detailed)
[obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box); [obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
@ -152,6 +166,8 @@ var NotificationsBox = GObject.registerClass({
[obj.titleLabel, obj.countLabel] = this._makeNotificationSource(source, box); [obj.titleLabel, obj.countLabel] = this._makeNotificationSource(source, box);
box.visible = obj.visible && (source.unseenCount > 0); box.visible = obj.visible && (source.unseenCount > 0);
this._updateSourceBoxStyle(source, obj, box);
} }
_sourceAdded(tray, source, initial) { _sourceAdded(tray, source, initial) {
@ -165,6 +181,7 @@ var NotificationsBox = GObject.registerClass({
sourceBox: null, sourceBox: null,
titleLabel: null, titleLabel: null,
countLabel: null, countLabel: null,
hasCriticalNotification: false,
}; };
obj.sourceBox = new St.BoxLayout({ obj.sourceBox = new St.BoxLayout({