toastify icon indicating copy to clipboard operation
toastify copied to clipboard

Doesn't replace notification with xfce4-notifyd

Open kovetskiy opened this issue 4 years ago • 4 comments

It seems like xfce4-notifyd ignores toastify's --id option:

toastify send --debug --id 2 q
toastify send --debug --id 2 w

will show two notifications.

toastify-git v0.3.0.r14.gb81b6a0-1 xfce4-notifyd v0.6.1

kovetskiy avatar Jul 03 '20 18:07 kovetskiy

that is sometimes up to the desktop environment how it handles this. I think I've seen this before. there are two ways of "updating" a notification:

  1. reuse the handle (like toastify does)
  2. actually holding open the dbus connection and sending on the same connection again

I can't take any guarantees that xfce4-notifyd does what you want, but you could try out if it does when you update the notification using option 2. like in this example: https://github.com/hoodie/notify-rust/blob/master/examples/update.rs#L71

hoodie avatar Jul 04 '20 08:07 hoodie

On the other hand, it works well with notify-desktop and xfce4-notifyd

#!/bin/bash

notify() {
    file=/tmp/notify-id
    id=$(cat $file 2>/dev/null)

    notify-desktop -r "$id" -t 3000 "$@" | tee "$file"
}

notify "$(date)"
sleep 1
notify "$(date)"
sleep 1
notify "$(date)"
sleep 1
notify "$(date)"

(notification will be replaced)

kovetskiy avatar Jul 04 '20 09:07 kovetskiy

🤔 interesting thanks for the reproducer - can you tell if dbus-monitor "interface=org.freedesktop.Notifications" shows any difference?

hoodie avatar Jul 04 '20 22:07 hoodie

I can't say there are some real differences like some flags are different, but notify-desktop outputs a new id if current id can't be replaced. Toastify doesn't output a new id.

I've tried reusing notify-desktop's id and pass id to toastify but it leads to an interesting result — toastify freezes completely.

Reproducer:

#!/bin/bash

notify() {
    file=/tmp/notify-id
    id=$(cat $file 2>/dev/null)

    notify-desktop -r "$id" -t 3000 "$@" | tee "$file"
}

toastify() {
    toastify send -t 3000 --debug --id "$(cat /tmp/notify-id)" "$@"
}

notify "$(date)"
sleep 1
toastify "$(date)"

kovetskiy avatar Jul 16 '20 13:07 kovetskiy