notification-hub

distraction-free notification daemon for simple linux desktops.
git clone https://git.ce9e.org/notification-hub.git

commit
4d3f4a79b144fee6fb7b1ea0e25719808c036f12
parent
8a86660be5247fd1f3999a6de7c1310ede5d92c5
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-02-12 18:29
refactor constants

Diffstat

M notification_hub.py 17 +++++++++--------

1 files changed, 9 insertions, 8 deletions


diff --git a/notification_hub.py b/notification_hub.py

@@ -14,10 +14,8 @@ __version__ = '0.0.0'
   14    14 
   15    15 IGNORE = []
   16    16 
   17    -1 FDN_PATH = '/org/freedesktop/Notifications'
   18    -1 FDN_IFAC = 'org.freedesktop.Notifications'
   19    -1 
   20    -1 INTROSPECTION_XML = """<?xml version="1.0" encoding="UTF-8"?>
   -1    17 NODE_INFO = Gio.DBusNodeInfo.new_for_xml("""
   -1    18 <?xml version="1.0" encoding="UTF-8"?>
   21    19 <node name="/org/freedesktop/Notifications">
   22    20     <interface name="org.freedesktop.Notifications">
   23    21         <method name="GetCapabilities">
@@ -44,7 +42,7 @@ INTROSPECTION_XML = """<?xml version="1.0" encoding="UTF-8"?>
   44    42             <arg direction="out" name="spec_version"    type="s"/>
   45    43         </method>
   46    44    </interface>
   47    -1 </node>"""
   -1    45 </node>""")
   48    46 
   49    47 next_id = 1
   50    48 indicator = None
@@ -142,8 +140,11 @@ def on_call(
  142   140 
  143   141 
  144   142 def on_bus_acquired(conn, name, user_data=None):
  145    -1     node_info = Gio.DBusNodeInfo.new_for_xml(INTROSPECTION_XML)
  146    -1     conn.register_object(FDN_PATH, node_info.interfaces[0], on_call)
   -1   143     conn.register_object(
   -1   144         '/org/freedesktop/Notifications',
   -1   145         NODE_INFO.interfaces[0],
   -1   146         on_call,
   -1   147     )
  147   148 
  148   149 
  149   150 def on_name_lost(conn, name, user_data=None):
@@ -156,7 +157,7 @@ def on_name_lost(conn, name, user_data=None):
  156   157 if __name__ == '__main__':
  157   158     owner_id = Gio.bus_own_name(
  158   159         Gio.BusType.SESSION,
  159    -1         FDN_IFAC,
   -1   160         NODE_INFO.interfaces[0].name,
  160   161         Gio.BusNameOwnerFlags.NONE,
  161   162         on_bus_acquired,
  162   163         None,