GitHub30 / win11toast

Toast notifications for Windows 10 and 11 based on WinRT
https://pypi.org/project/win11toast/
MIT License
212 stars 15 forks source link

Support clearing previous notification #40

Open ikus060 opened 1 month ago

ikus060 commented 1 month ago

Hello,

I'm a new user of this library. Thanks a lot for this simple to use notification library for Windows !

I have a specific use case in my application where I want to raise a notification under certain conditions, but if theses conditions are no longer meet, I want to be able to clear the previous notification that was raised.

e.g.: If connection to remote server cannot be established, then I raise a notification .. When connection to remote server is restored, I want to clear the notification.

Looking at Windows API. Is seams to be possible to update or clear notification by defining tag and/or group.

My expectations

  1. the function notify() should allow defining custom tag and custom group
  2. a new function remove(tag, group) should be defined to clear notification identified by tag and group.
Radexito commented 1 month ago

+1 I also need this.

Lets say my app is doing Step1, then it finished it so it showed user the toast (he did not close it). Now user starts doing Step2, i want to clear all toasts.

ikus060 commented 1 month ago

@Radexito This is now supported by calling clear_toast(app_id=APP_ID, tag=notification_id, group='default').

But I did not update the README with an example.