astal-sh / notifd

A notification daemon library and cli tool
GNU Lesser General Public License v2.1
6 stars 0 forks source link

Incorrect signals being sent when any notification is resolved in proxy mode #2

Open muhchaudhary opened 3 months ago

muhchaudhary commented 3 months ago

I've noticed that when using AstalNotifd in proxy mode, dismissing/resolving any single notification will collectively send a resolved signal for all current notifications.

Steps to reproduce:

  1. Start the notification daemon in a seperate terminal (astal-notifd -d)
  2. Start AstalNotifd.Notifd.new() (This will start in proxy mode)
  3. send multiple notifications (example: notify-send "Hello World" followed by notify-send "Hello World -t 1000")
Aylur commented 3 months ago

cant reproduce, are you sure you are not calling dismiss yourself somewhere?

This is what I did and it works as expected

import Notifd from "gi://AstalNotifd"
import GLib from "gi://GLib"

const notifd = new Notifd.Notifd

notifd.connect("notified", (_, id) => {
    print("notifd", notifd.get_notification(id).summary)
})

notifd.connect("resolved", (_, id) => {
    print("resolved", id)
})

new GLib.MainLoop(null, false).run()
❯  astal-notifd -d
{"id":1,"time":1717343017,"expire_timeout":-1,"app_name":"notify-send","app_icon":"","summary":"hello world","body":"","actions":[],"hints":{"urgency":1,"sender-pid":507830}}
{"id":2,"time":1717343017,"expire_timeout":-1,"app_name":"notify-send","app_icon":"","summary":"hello world","body":"","actions":[],"hints":{"urgency":1,"sender-pid":507952}}
{"id":3,"time":1717343018,"expire_timeout":-1,"app_name":"notify-send","app_icon":"","summary":"hello world","body":"","actions":[],"hints":{"urgency":1,"sender-pid":508000}}
{"id":4,"time":1717343024,"expire_timeout":1000,"app_name":"notify-send","app_icon":"","summary":"hello world","body":"","actions":[],"hints":{"urgency":1,"sender-pid":508299}}
❯  gjs test.js
notifd hello world
notifd hello world
notifd hello world
notifd hello world
resolved 4
notify-send "hello world"
notify-send "hello world"
notify-send "hello world"
notify-send "hello world" -t 1000