notification-hub

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

commit
ef3b0a96b3e40a9b9407ac9d86b76fe4ee0e168f
parent
9463b60c4f368ad2adf8e07bba5a383c417e7e79
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-02-18 22:16
store only one id per app

we only store one label anyway

Diffstat

M README.md 2 +-
M notification_hub.py 12 ++++--------

2 files changed, 5 insertions, 9 deletions


diff --git a/README.md b/README.md

@@ -17,7 +17,7 @@ Distraction-free notification daemon for simple linux desktops.
   17    17 
   18    18 ## Known Limitations
   19    19 
   20    -1 -	Only supports `app_name`, `replaces_id`, and `summary`. Everything else
   -1    20 -	Only supports `app_name` and `summary`. Everything else
   21    21 	(expiration, icons, HTML body, actions) is ignored.
   22    22 -	Lies about the supported features to other software to avoid fallbacks (e.g.
   23    23 	in firefox)

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

@@ -82,9 +82,7 @@ def on_add_notification(params, id):
   82    82         label = f'{app_name}: {params["summary"]}'
   83    83 
   84    84     if thread:
   85    -1         if params['replaces_id'] in thread['ids']:
   86    -1             thread['ids'].remove(params['replaces_id'])
   87    -1         thread['ids'].add(id)
   -1    85         thread['id'] = id
   88    86         thread['menuitem'].set_label(label)
   89    87     else:
   90    88         item = Gtk.MenuItem(label=label)
@@ -95,16 +93,14 @@ def on_add_notification(params, id):
   95    93 
   96    94         threads[app_name] = {
   97    95             'menuitem': item,
   98    -1             'ids': {id},
   -1    96             'id': id,
   99    97         }
  100    98 
  101    99 
  102   100 def on_close_notification(id):
  103   101     for key, thread in list(threads.items()):
  104    -1         if id in thread['ids']:
  105    -1             thread['ids'].remove(id)
  106    -1             if not thread['ids']:
  107    -1                 clear_thread(thread['menuitem'], key)
   -1   102         if id == thread['id']:
   -1   103             clear_thread(thread['menuitem'], key)
  108   104 
  109   105 
  110   106 def on_call(