Description
Is your feature request related to a problem? Please describe.
See #317: I wanted to keep a record of notifications timed out and if i want to resolve manually because a notification does not have a specified timeout, the application crashes
Problem(s):
- The timeout with the timeout of expire_timeout is only created, if expire_timeout is set at Notification spawn (see: https://github.com/Aylur/astal/blob/main/lib/notifd/daemon.vala#L139), which few applications actually do; meaning i would have to add a timeout that resolves this in my non-vala user code
- As per LGI warnings/crashes when firing on_resolved signal on notification #317 the whole interaction with letting notifications expire through manually resolving from user code (in this case lua) causes a crash.
Describe the solution you'd like
add a default timeout for notifications as per spec (https://specifications.freedesktop.org/notification-spec/latest/protocol.html#id-1.10.3.3.4)
If -1, the notification's expiration time is dependent on the notification server's settings, and may vary for the type of notification.
this might be accompanied by a property on the daemon.
Describe alternatives you've considered
i considered not using resolve but pretending i used the method i want to use for expired messages, however i feel like this kind of defeats the purpose of offering the expire functionality inside the library.
Additional context
i think the logic should look something like this if i understood the spec correctly?
if (expire_timeout == -1) {
expire_timeout = default_timeout
}
if (!ignore_timeout && expire_timeout > 0) {
Timeout.add(expire_timeout, () => {
if (!ignore_timeout) {
resolved(id, ClosedReason.EXPIRED);
}
return Source.REMOVE;
}, Priority.DEFAULT);
}