I'm trying to display notifications with the Notification module of pygobject (version 3.16) in python. My code works well, except when there is a <
in the body message. In this case, the body is not displayed.
For example with this code, all is OK:
from gi.repository import Gtk, Notify
def callback(notification, action_name):
notification.close()
Gtk.main_quit()
Notify.init('test')
notification = Notify.Notification.new('Title', 'body')
notification.set_timeout(Notify.EXPIRES_NEVER)
notification.add_action('quit', 'Quit', callback)
notification.show()
Gtk.main()
But with this one there is a problem:
from gi.repository import Gtk, Notify
def callback(notification, action_name):
notification.close()
Gtk.main_quit()
Notify.init('test')
notification = Notify.Notification.new('Title', '<body')
notification.set_timeout(Notify.EXPIRES_NEVER)
notification.add_action('quit', 'Quit', callback)
notification.show()
Gtk.main()
I get that:
When the <
is in the title, or when I use a >
there is no problem.
I tried to escape the <
, but it didn't do anything.
So, how could I display a body text containing a <
?
I've noticed that in Gtk there is sometimes html code, like when using
set_markup
.I tried with the hmtl equivalent<
and it worked fine: