Aylur / astal

Building blocks for creating custom desktop shells
https://aylur.github.io/astal/
GNU Lesser General Public License v2.1
279 stars 35 forks source link

[Notifd] Notification urgency always 0/low #110

Closed Stinjul closed 1 week ago

Stinjul commented 1 week ago

Describe the bug The urgency of notifications is always 0/low.

To Reproduce Create a simple app like this:

import { App } from "astal/gtk3";
import Notifd from "gi://AstalNotifd";

App.start({
    main() {
        const notifd = Notifd.get_default();

        notifd.connect("notified", (_, id) => {
            const n = notifd.get_notification(id);
            print(`${n.summary}:  ${n.urgency}`);
        });
    },
});

Send some notifs using notify-send from libnotify:

notify-send -u critical "crit notif"
notify-send -u low "low notif"

Observe the ags ouput:

crit notif:  0
low notif:  0

Additional context Looking at the code i found out there's a state file which contains this:

{
    "notifications": [
        {
            "id": 2,
            "time": 1731873696,
            "expire_timeout": -1,
            "app_name": "notify-send",
            "app_icon": "",
            "summary": "low notif",
            "body": "",
            "actions": [],
            "hints": {
                "urgency": 0,
                "sender-pid": 691431
            }
        },
        {
            "id": 1,
            "time": 1731873695,
            "expire_timeout": -1,
            "app_name": "notify-send",
            "app_icon": "",
            "summary": "crit notif",
            "body": "",
            "actions": [],
            "hints": {
                "urgency": 2,
                "sender-pid": 691372
            }
        }
    ],
    "ignore_timeout": false,
    "dont_disturb": false
}

The urgency hint values are correct so my guess is they're getting set to 0 here but I'm not sure why. Maybe urgency is getting parsed wrong somewhere?