#!/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()