-
Notifications
You must be signed in to change notification settings - Fork 15
Add on_cleared event #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add on_cleared event #208
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #208 +/- ##
==========================================
+ Coverage 85.26% 85.78% +0.51%
==========================================
Files 10 10
Lines 964 1013 +49
==========================================
+ Hits 822 869 +47
- Misses 142 144 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9a16756 to
4968441
Compare
|
As for #209, could you check if similar events are available on macOS and Windows? |
|
Windows doesn't have a similar event (I checked). Can't say anything about OS X because I neither understand their overly complex API, nor do I have an Apple device to do manual testing. I'm afraid anything OS-X-related is up to you. As said earlier, my ultimate goal is to use this for #206 too, i.e. independent of the backend used. I'm just not sure yet how to prevent calling the dismissal class-level handler. However, this isn't really relevant here, see #206. |
samschott
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks and apologies for the delay in reviewing!
Do you think there is any value in distinguishing between expired and programatically closed notifications?
| ON_CLEARED = auto() | ||
| """Supports distinguishing between an user closing a notification, and clearing a | ||
| notification programmatically, and consequently supports on-cleared callbacks""" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "Supports callbacks on programmatic closing and notification timeouts"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm… Reading through both my original suggestion five months later and yours now, I'd interpret both like "if this cap isn't set, the notification can't be closed programmatically". I made another attempt, WDYT?
This event is fired when a notification was closed without user interaction, e.g. because the notification timed out (DBus only, and only if supported by the notifications server; undetectable by capabilities), or because the notification was closed by another process (DBus only).
We could. It's been five months, so I've forgotten a lot of my original reasoning 😆 Sometimes that's a good thing: I now spent quite some time to think about this, especially in regards to #206, and distinguishing between those as well makes things easier for #206, too: We could then have a separate handler for #206 and the issues with #206 about duplicate events magically disappear thanks to I've rebased and updated this PRs accordingly. I'll update the other PRs as well. |
01cd7a6 to
7ca8d3f
Compare
|
@PhrozenByte, did you actually update this PR to separate timeout and programmatic clearing calbacks? |
Improve docs of the `ON_CLEARED` capability and update other docs to allow distinguishing between expired and programatically closed notifications in the future. Actually adding support for expiring notifications is out-of-scope here.
7ca8d3f to
e87b3ca
Compare
|
Yes. I assume you ask because I forgot to remove |
|
PR is up-to-date with After this has been merged I'll look into getting #200 back on track, it's mostly a single feature then (introducing |
This event is fired when a notification was closed without user interaction, e.g. because the notification timed out (DBus only, and only if supported by the notifications server; undetectable by capabilities), or because the notification was closed by another process (DBus only).
We'll later also utilize this for the cross-platform implementation of
timeout.Without this new event we'd have to remove the
if reason == NOTIFICATION_CLOSED_DISMISSED:check inDBusDesktopNotifier.ToDo:
Notification.on_clearedmust be changed to:notificationparam fromhandle_*()methods #205DesktopNotifierBackend.on_clearedmust be changed to:notificationparam fromhandle_*()methods #205DesktopNotifierBackend.on_clearedalso update the docstring ofDesktopNotifier.on_clearedon_clearedtoDesktopNotifierSyncafter merging DesktopNotifierSync: Addon_*properties for class-level events #207