How can i send notifications in GNOME
through a python program?
I have tried python bindings like pynotify
,python-notify2
, but the all give pop-up notifications which are temporary. Is there any python bindings to give notifications on the message tray in GNOME
?
You must use PyGObject, which gives you access to the GNOME platform through the use of GObject introspection. You can read an example in the Arch documentation for Desktop notifications:
from gi.repository import Notify
Notify.init ("Hello world")
Hello=Notify.Notification.new ("Hello world",
"This is an example notification.",
"dialog-information")
# Hello.set_timeout(0)
Hello.show ()
A timeout value of 0
makes it persistent (until the mouse is moved). For more information check out the PyGObject API Reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With