- commit
- e55cc45cd967cc21425a7bad3163daf09456669c
- parent
- ba8f7a467521912c47f0e00dfc911d957ad38eb6
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-10-11 10:01
smarter label formatting
Diffstat
| M | notification_hub.py | 20 | ++++++++++++++++++-- |
1 files changed, 18 insertions, 2 deletions
diff --git a/notification_hub.py b/notification_hub.py
@@ -70,13 +70,29 @@ def clear_thread(item, key): 70 70 indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE) 71 71 72 72 -1 73 def format_label(params): -1 74 app_name = params[0] -1 75 summary = params[3] -1 76 body = params[4] -1 77 hints = params[6] -1 78 desktop_entry = hints.get('desktop-entry') -1 79 -1 80 _app_name = app_name or desktop_entry -1 81 if _app_name: -1 82 if summary != _app_name: -1 83 return '%s: %s' % (_app_name, summary) -1 84 else: -1 85 return '%s: %s' % (_app_name, body[:40]) -1 86 else: -1 87 return summary -1 88 -1 89 73 90 def on_add_notification(params, id): 74 91 app_name = params[0] 75 92 replaces_id = params[1]76 -1 summary = params[3]77 93 hints = params[6] 78 9479 -1 label = f'{app_name}: {summary}'-1 95 label = format_label(params) 80 96 key = hints.get('desktop-entry', app_name) 81 97 thread = threads.get(key) 82 98