-
Notifications
You must be signed in to change notification settings - Fork 13
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #208 +/- ##
==========================================
+ Coverage 85.06% 85.90% +0.83%
==========================================
Files 10 10
Lines 951 958 +7
==========================================
+ Hits 809 823 +14
+ Misses 142 135 -7
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. |
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 |
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_cleared
must be changed to:notification
param fromhandle_*()
methods #205DesktopNotifierBackend.on_cleared
must be changed to:notification
param fromhandle_*()
methods #205DesktopNotifierBackend.on_cleared
also update the docstring ofDesktopNotifier.on_cleared
on_cleared
toDesktopNotifierSync
after merging DesktopNotifierSync: Addon_*
properties for class-level events #207