Package: python3-giVersion: 3.38.0-2
No error messages are generated; the notification simply does not appear.
The problem exists on a freshly-installed Debian 11.1 system.
Here is an SSCCE that demonstrates the problem:
#!/usr/bin/env python3
"""
Minimal program that replicates the failure to Notify - most of the time.
When I ran this on one system, it consistently failed.
When I ran it on a new system, it succeeded once and then failed
consistently thereafter.
"""
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk # noqa: E402
from gi.repository import GLib # noqa: E402
gi.require_version('Notify', '0.7') # noqa: disable=E402
from gi.repository import Notify # pylint: disable=no-name-in-module
# noqa: disable=E402
def notify_by_libnotify():
"""Create a notify-osd popup using gi."""
Notify.init("sscce")
notification = Notify.Notification.new('note')
notification.set_urgency(2)
notification.show()
print('notification.show() executed', file=sys.stderr)
window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
window.show()
GLib.idle_add(notify_by_libnotify)
Gtk.main()
Thanks!