-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add cross-platform notification timeouts #206
base: main
Are you sure you want to change the base?
Add cross-platform notification timeouts #206
Conversation
Linux (DBus) is the only platform that theoretically supports timeouts, but few (if any?) notification servers actually implement timeouts. Windows exposes a `expiration_time` property, but this doesn't close the notification, but just controls after what time the toast is hidden and the notification sent to the notifications center (i.e. the notification isn't actually closed). OS X doesn't support expiration. We therefore implement our own cross-platform notification timeouts.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #206 +/- ##
==========================================
- Coverage 85.13% 85.13% -0.01%
==========================================
Files 10 10
Lines 895 915 +20
==========================================
+ Hits 762 779 +17
- Misses 133 136 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Supporting timeouts is a pretty complex topic. First it depends on what one means by "timeout": "Timeout" could mean "auto-close the notification after n seconds". "Timeout" could also mean "hide the toast after n seconds and send the notification to the notifications center". Windows has a However, for a notifications server without persistence (i.e. without a notifications center) there's just no such difference: If a notification times out on such notifications server, it's gone. This difference is also acknowledged by the FreeDesktop.org specs on Linux by adding a So in the end I'd say that interpreting "timeout" like Windows doesn't make much sense for WDYT? |
Linux (DBus) is the only platform that theoretically supports timeouts, but few (if any?) notification servers actually implement timeouts. Windows exposes a
expiration_time
property, but this doesn't close the notification, but just controls after what time the toast is hidden and the notification sent to the notifications center (i.e. the notification isn't actually closed). OS X doesn't support expiration. We therefore implement our own cross-platform notification timeouts.THIS IS WORK IN PROGRESS
I want to make sure that the
on_cleared
event is called in case of an timeout on all platforms, not just on Linux. I'm not entirely sure how to implement this yet... Just callinghandle_cleared
doesn't work very well because backends will still issue anon_dismissed
event. This won't triggerNotification.on_dismissed
because the notification was removed from the cache byhandle_cleared
already, but the class-level callback will still fire... I have to think about that...Closes #46