diff --git a/docs/notifications.py b/docs/notifications.py index 215bae805..218af47aa 100644 --- a/docs/notifications.py +++ b/docs/notifications.py @@ -18,6 +18,12 @@ def log_notification(nc: NotificationCommand) -> None: print('\n', file=log) +def on_notification_activated(nc: NotificationCommand) -> None: + # do something when this notification is activated (clicked on) + # remember to assign this to the on_activation field in main() + pass + + def main(nc: NotificationCommand) -> bool: ''' This function should return True to filter out the notification @@ -45,5 +51,8 @@ def main(nc: NotificationCommand) -> bool: if nc.application_name == 'myapp' and nc.notification_type == 'foo': subprocess.Popen(['/path/to/my/script', nc.title, nc.body]) + # do some arbitrary actions when this notification is activated + nc.on_activation = on_notification_activated + # dont filter out this notification return False