/ src / plugins / notification_notify2.py
notification_notify2.py
 1  # -*- coding: utf-8 -*-
 2  """
 3  Notification plugin using notify2
 4  """
 5  
 6  import gi
 7  gi.require_version('Notify', '0.7')
 8  from gi.repository import Notify  # noqa:E402
 9  
10  Notify.init('pybitmessage')
11  
12  
13  def connect_plugin(title, subtitle, category, _, icon):
14      """Plugin for notify2"""
15      if not icon:
16          icon = 'mail-message-new' if category == 2 else 'pybitmessage'
17      connect_plugin.notification.update(title, subtitle, icon)
18      connect_plugin.notification.show()
19  
20  
21  connect_plugin.notification = Notify.Notification.new("Init", "Init")