diff --git a/data/theme/gnome-shell-sass/widgets/_login-lock.scss b/data/theme/gnome-shell-sass/widgets/_login-lock.scss index 7e00a4623..323482b6d 100644 --- a/data/theme/gnome-shell-sass/widgets/_login-lock.scss +++ b/data/theme/gnome-shell-sass/widgets/_login-lock.scss @@ -263,6 +263,11 @@ $_gdm_dialog_width: 25em; &.critical { background-color: transparentize($_gdm_fg,0.8) } } + + .unlock-dialog-notification-source .message { + background-color: transparent; + &:hover,&:focus { background-color: transparent; } + } } .unlock-dialog-notification-icon { diff --git a/js/ui/mpris.js b/js/ui/mpris.js index 6a4e31136..bc9a6fd77 100644 --- a/js/ui/mpris.js +++ b/js/ui/mpris.js @@ -49,6 +49,9 @@ class MediaMessage extends MessageList.Message { } vfunc_clicked() { + if (Main.sessionMode.isLocked) + return; + this._player.raise(); Main.panel.closeCalendar(); } @@ -151,7 +154,7 @@ export class MprisPlayer extends Signals.EventEmitter { this._mprisProxy.RaiseAsync().catch(logError); } - _close() { + close() { this._mprisProxy.disconnectObject(this); this._mprisProxy = null; @@ -165,13 +168,13 @@ export class MprisPlayer extends Signals.EventEmitter { this._mprisProxy.connectObject('notify::g-name-owner', () => { if (!this._mprisProxy.g_name_owner) - this._close(); + this.close(); }, this); // It is possible for the bus to disappear before the previous signal // is connected, so we must ensure that the bus still exists at this // point. if (!this._mprisProxy.g_name_owner) - this._close(); + this.close(); } _onPlayerProxyReady() { @@ -249,9 +252,15 @@ class MediaSection extends MessageList.MessageListSection { _init() { super._init(); + this.connect('destroy', + () => this._onDestroy()); + this._players = new Map(); - this._proxy = new DBusProxy(Gio.DBus.session, + this._proxy = null; + this._nameOwnerChangedId = 0; + + new DBusProxy(Gio.DBus.session, 'org.freedesktop.DBus', '/org/freedesktop/DBus', this._onProxyReady.bind(this)); @@ -283,7 +292,9 @@ class MediaSection extends MessageList.MessageListSection { this._players.set(busName, player); } - async _onProxyReady() { + async _onProxyReady(proxy) { + this._proxy = proxy; + const [names] = await this._proxy.ListNamesAsync(); names.forEach(name => { if (!name.startsWith(MPRIS_PLAYER_PREFIX)) @@ -291,8 +302,9 @@ class MediaSection extends MessageList.MessageListSection { this._addPlayer(name); }); - this._proxy.connectSignal('NameOwnerChanged', - this._onNameOwnerChanged.bind(this)); + this._nameOwnerChangedId = + this._proxy.connectSignal('NameOwnerChanged', + this._onNameOwnerChanged.bind(this)); } _onNameOwnerChanged(proxy, sender, [name, oldOwner, newOwner]) { @@ -302,4 +314,11 @@ class MediaSection extends MessageList.MessageListSection { if (newOwner && !oldOwner) this._addPlayer(name); } + + _onDestroy() { + for (const player of this._players.values()) + player.close(); + this._proxy?.disconnectSignal(this._nameOwnerChangedId); + this._proxy = null; + } }); diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index f741b20a6..04bedc6a6 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -18,6 +18,7 @@ import * as MessageTray from './messageTray.js'; import * as SwipeTracker from './swipeTracker.js'; import {formatDateWithCFormatString} from '../misc/dateUtils.js'; import * as AuthPrompt from '../gdm/authPrompt.js'; +import {MediaSection} from './mpris.js'; // The timeout before going back automatically to the lock screen (in seconds) const IDLE_TIMEOUT = 2 * 60; @@ -51,6 +52,12 @@ const NotificationsBox = GObject.registerClass({ }); this.add_child(this._scrollView); + const mediaSection = new MediaSection(); + mediaSection.style_class = 'unlock-dialog-notification-source'; + mediaSection.connect('notify::visible', + () => this._updateVisibility()); + this._notificationBox.add_child(mediaSection); + this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.notifications', });