manatools / dnfdragora

dnfdragora is a dnf frontend based on libyui abstraction
GNU General Public License v3.0
137 stars 41 forks source link

update notification does not disapear by itself in Xfce #178

Closed hannes101 closed 3 years ago

hannes101 commented 3 years ago

I can't exactly say, when this issue started to happen, it was not that long ago. Previously the notification of dnfdragora-update that X updates are available just vanished after the defined time of the Xfce notification plugin. But now it does not disappear anymore and it always require a click on the notification to go away. This is on a fully upgraded fedora 33 with Xfce 4.14 and dnfdragora-2.1.0-2. All other notifications work as expected, but of course this could also be a bug in Xfce.

anaselli commented 3 years ago

Sorry it isn't clear to me which the problem really is for you. Our code does not close notification. 2.1.x added pystray notification instead of pynotify since the were conflicting using both in our experience. According to last documentation to remove notification we should need to do it by direct calling _removenotification() but we didn't use any timer before an either now. If that is what you meant this is a workforme.

hannes101 commented 3 years ago

Of course it's not dnfdragora, which closes the notification, but I suspect that the switch from pynotify to pystray might be the cause for the changed behaviour. Perhaps this new implementation is not properly implemented in Xfce. I will investigate with the Xfce devs, if this is more on their side. Thanks for the quick reply.

hannes101 commented 3 years ago

I've opened an upstream bug at Xfce, https://gitlab.xfce.org/apps/xfce4-notifyd/-/issues/41

alexmalykh commented 3 years ago

I upgraded from F32 to F33 recently and confirm the issue. Session dbus monitoring has shown that notification requests coming from dnfdragora-updater have zero expiration timeout. According to freedesktop.org notifications spec:

If -1, the notification's expiration time is dependent on the notification server's settings, and may vary for the type of notification. If 0, never expire.

That's why notification balloons don't dissappear automatically. The reason is hard-coded zero in pystray dbus backend. Thus, the only way to hide the balloon is to call pystray's hide() method explicitly.

hannes101 commented 3 years ago

But where is the bug then, pystray, xfce4-notifyd or in dnfdragora? Just to make sure it can be fixed in the right places.

alexmalykh commented 3 years ago

I think, it should be fixed in dnfdragora - close the notification balloon explicitly, as meant by pystray authors.

anaselli commented 3 years ago

well when we used pynotify we didn't close notification at all. KDE has a list of notification that must be close by user as far as i know, but notify compare only for a while.. is there a freedesktop specification for notification behavior, so that closing an issue for xfce does not mean opening a new one on another desktop? (adding @Conan-Kudo to see what he thinks about this too)

alexmalykh commented 3 years ago

Right, the balloons closed automatically because notify2 sets _expiretimeout = -1 by default (see here). As spec says, in this case it's up to notification daemon how to treat the balloon. xfce4-notifyd daemon closes such notifications in one second, but one of KDE/Plasma might have another defaults.

anaselli commented 3 years ago

So pystray cannot have the same behavior since they hardcoded 0, right?

alexmalykh commented 3 years ago

Yes. Balloons for pystray notifications are non-expiring and could be closed either by mouse click or programmatically.

anaselli commented 3 years ago

well, that means we'll see how we could manage it then... if someone had patches to provide... he's welcome too :D Thanks to all for pointing us that

ochosi commented 3 years ago

It isn't necessary to explicitly close the nofitication in order for the bubble to disappear in xfce4-notifyd.

If a notification is marked as "urgency:critical" xfce4-notifyd doesn't close it automatically which is what the spec says (see here: https://developer.gnome.org/notification-spec/)

So my presumption (without having read the code) is you set this urgency hint and a lower level would make the notification expire automatically.

alexmalykh commented 3 years ago

@ochosi there is no way to set urgency hint for a notification using pystray, because hints parameter is hardcoded as well (empty list).

anaselli commented 3 years ago

I opened an issue here https://github.com/moses-palmer/pystray/issues/84

anaselli commented 3 years ago

upstream seems to have accepted the suggestion to use -1! Please let us know if it works now

orschiro commented 3 years ago

Great! Will this fix be shipped on Xfce 4.16?

On Wed, 10 Feb 2021 at 18:49, Angelo Naselli notifications@github.com wrote:

upstream seems to have accepted the suggestion to use -1! Please let us know if it works now

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/manatools/dnfdragora/issues/178#issuecomment-776894017, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABJXQ7IECYNEDUV7VFDMLDS6LBLNANCNFSM4VRWPX4Q .

anaselli commented 3 years ago

well it should be pystray only...

max-dw-i commented 3 years ago

Can confirm that with the newest version of pystray (0.17.3) the balloon disappears automatically.

anaselli commented 3 years ago

great, so we should revert the code then before closing this issue :)

Woi commented 3 years ago

Packaging request for Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1903824#c4

hannes101 commented 3 years ago

I made a scratch build for fedora 33. https://koji.fedoraproject.org/koji/taskinfo?taskID=65149500

Woi commented 3 years ago

Updates for Fedora 34 and 35 (currently in development) are available. Fedora 32 and 33 might not get fixes. See details in above bug description.