Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't replace notification with xfce4-notifyd #8

Open
kovetskiy opened this issue Jul 3, 2020 · 4 comments
Open

Doesn't replace notification with xfce4-notifyd #8

kovetskiy opened this issue Jul 3, 2020 · 4 comments

Comments

@kovetskiy
Copy link

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

@hoodie
Copy link
Owner

hoodie commented Jul 4, 2020

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

@kovetskiy
Copy link
Author

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)

@hoodie
Copy link
Owner

hoodie commented Jul 4, 2020

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

@kovetskiy
Copy link
Author

kovetskiy commented Jul 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants