Skip to content

add a default timeout property to Notifd #319

Open
@paulhersch

Description

@paulhersch

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):

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);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions