emersion / mako

A lightweight Wayland notification daemon
https://wayland.emersion.fr/mako
MIT License
2.17k stars 137 forks source link

Implement `makoctl count` script command with variants #526

Open fidelicura opened 1 month ago

fidelicura commented 1 month ago

This PR adds new command to makoctl as makoctl count. It allows a user to get number of notifications that are currently in history or in a waiting state. It may be useful for software producing a lot of notifications (e.g. single-point DBs) or any other use case where notifications are used as counter for something. The result looks like this:

{
        "type" : "u",
        "data" : [
             5
        ]
}

...where 5 is the number of notifications in the history or on the screen (waiting) at the moment.

See also original idea from 2017 in dunst. It is the same sub-command that was initially named status, and now named count: issue, commit.

emersion commented 1 month ago

Do we really need to add a new D-Bus method here? Couldn't we use the same as makoctl list and use jq to count the number of entries?

fidelicura commented 1 month ago

Do we really need to add a new D-Bus method here? Couldn't we use the same as makoctl list and use jq to count the number of entries?

Now I don't think we need a new D-Bus method, so no. I did it as a script command in the latest force-push, but I think it is not that necessary anymore if the user can just use jq for this purpose. I won't be upset if you just close this PR.