Search code examples
pythonnotificationspynotify

Is it possible to change the title of a notification?


Is it possible to change the title of a pynotify.Notification? If so what is the method call to use?

Also, it is possible to merge notifications using set_hint_string('append', ''). Is it possible to change a title and keep them merged.

I want something like the following (not real code, just a description of the effect) to happen:

Notification("Something is happening") + Notification("Something is happening") -> Notification("2 things are happening")

Solution

  • Perhaps use the update method:

    import pynotify
    import time   
    
    pynotify.init('app name')
    n=pynotify.Notification("title","Something is happening")
    n.show()
    time.sleep(2)
    n.update("new title","2 things are happening")
    n.show()