dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.44k stars 338 forks source link

Gif Support #773

Open mcgdb opened 3 years ago

mcgdb commented 3 years ago

I'd like to help....Is it possible to allow animated gifs for icons?

tsipinakis commented 3 years ago

Using animated gifs is not currently possible, dunst will simply show the first frame.

Implementation wise there is some support in GDK pixbuf for animations, however the difficulty would be to get the update frequency right.

Currently redrawing is an expensive procedure as we redraw from scratch all notifications so we avoid doing it as much as possible. Implementing that would require some refactoring to store intermediate results and make the redraw process faster.

mcgdb commented 3 years ago

i've never been afraid of punching above my weight class....can you give me a hint of where to start looking (in the dunst project, i mean...that link to the gtk-pixbuf is a great clue!)

tsipinakis commented 3 years ago

Most of the work needs to be done in draw.c.

The goal is to be able to call draw to redraw the window with minimal cost to keep up with the gif framerate.

To implement gif support a rough plan would be:

But as I mentioned above for this to be merge-able I'd also like to see some optimizations in the drawing procedure. Some things on the top of my head: Cache the icon rather than reloading it each time and cache the colored layout and any intermediaries and figure out a way to properly invalidate it when a notification is updated. There are probably more than can be done but these are the bare minimum IMO.

bynect commented 4 months ago

I would say that having different windows (#1018) would be really useful to this kind of thing (animations) since you can redraw single notifications and not the whole thing