Box-shadow support for notifications?
Hi there,
I was wondering if there is currently any support for adding a box-shadow (or similar effect) to notifications in Dunst? I think this would be a great visual enhancement, especially on modern desktop setups where a bit of shadow can help separate notifications from the background.
- I’ve looked through the documentation and issues, but couldn’t find anything definitive. #926 #1289
- Is this something that’s already possible via a workaround or configuration hack?
- Or has it perhaps been implemented recently in a way I missed?
If not, are there any technical reasons this isn’t feasible, or would it be worth considering as a feature request?
dunst itself cannot draw shadows now. but you can use a compositor effect to do that, for example picom supports that.
Thanks for the helpful hint! picom won't work for me, because it is for Xorg only and will not run on wayland, but I will look more into compositor effects and try to find something suitable for my setup.
dunst itself cannot draw shadows now. but you can use a compositor effect to do that, for example picom supports that.
I wanted to do this for Hyprland, but it seems it only supports shadows for windows, but not shell layers. It expects the shell layer to be responsible for drawing its own shadows.
I thought about implementing the shadow myself, but it seems cairo doesn't have gaussian blur support (it's been on the roadmap since 2016).
there is this example of theirs: https://www.cairographics.org/cookbook/blur.c/
Though I don't know if its the best way to do it. Anyway, shadows are definitely in the #1289 list.
there is this example of theirs: https://www.cairographics.org/cookbook/blur.c/
That example seems to be a software solution to blurring using an image surface. Looks promising, but at first glance I'm a bit concerned about performance. It might be fine if the surface can be reused though.
I feel like this should be something to be implemented on the compositor itself and not the notification. As @CelDaemon mentioned, having the notif handling the shadow could lead to performance issues.
I agree that using a software-based blur on image surfaces could introduce performance issues, especially for frequently updated notifications (for example changing audio volume or display brightness).
For a simple drop shadow effect, would it not be more efficient to just:
- Draw a solid or gradient-filled shape (rectangle with rounded corners matching the notification)
- Offset it by a few pixels
- Set it to a semi-transparent or solid color (for example
rgba(0, 0, 0, 0.3)) - Render it behind the notification
This would be a simple fill operation (just setting pixels to a specific color instead of blur calculations).