- commit
- 412c5139d113769b481ae2d05b866efac0b2e842
- parent
- 9f0d053376570381fb97a26794797737ef58067a
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-02-11 14:17
allow to ignore notifications
Diffstat
| M | notification_hub.py | 16 | ++++++++++++++++ |
1 files changed, 16 insertions, 0 deletions
diff --git a/notification_hub.py b/notification_hub.py
@@ -17,6 +17,8 @@ from gi.repository import AyatanaAppIndicator3 as AppIndicator3 # noqa 17 17 18 18 VERSION = '0.0.0' 19 19 -1 20 IGNORE = [] -1 21 20 22 FDN_PATH = '/org/freedesktop/Notifications' 21 23 FDN_IFAC = 'org.freedesktop.Notifications' 22 24 @@ -82,7 +84,21 @@ def format_label(params): 82 84 return params['summary'] 83 85 84 86 -1 87 def matches_rule(params, rule): -1 88 for key, pattern in rule.items(): -1 89 if key == 'hints': -1 90 for k, p in pattern.items(): -1 91 if p != params['hints'].get(k): -1 92 return False -1 93 elif pattern != params[key]: -1 94 return False -1 95 return True -1 96 -1 97 85 98 def on_add_notification(params, id): -1 99 if any(matches_rule(params, rule) for rule in IGNORE): -1 100 return -1 101 86 102 label = format_label(params) 87 103 key = params['hints'].get('desktop-entry', params['app_name']) 88 104 thread = threads.get(key)