Notifications in lock screen not updated by Notify.Notification.update()
mpDris2, a MPRIS2 bridge for mpd, pops up notifications for track changes. I have configured GNOME Shell to display their content, even in the lock screen: this lets me use a locked laptop as a music player by combining the media player hotkeys with lock screen notifications.
With obsolete code paths elided, what mpDris2 does boils down to this use of libnotify:
# during global initialization
from gi.repository import Notify
…
if Notify.init(identity):
self._notification = Notify.Notification()
self._notification.set_hint("desktop-entry", GLib.Variant("s", "mpdris2"))
self._notification.set_hint("transient", GLib.Variant("b", True))
…
self._notification.show()
…
# on each song change or other interesting event
self._notification.update(title, body, uri)
self._notification.show()
In the normal GNOME Shell view, this works fine. However, while in the lock screen, only the first notification to be displayed is effective. Subsequent mpDris2 events do not replace the original notification bubble, so the lock screen will display "Now playing: [track 1]" even when I've actually reached track 10.
Workaround: if I close()
the notification before the update()
, then the mpDris2 notification bubble momentarily disappears from the lock screen, and the replacement bubble has the correct content.
Should this be considered to be a bug in the GNOME Shell lock screen, or a bug in mpDris2?