Search code examples
linuxubuntudebiannotifykde-plasma

Send desktop notification in linux regardless of any Desktop Environment or Window manager in use


I'm wokring a simple cli tool for linux where sending desktop notification is required, initially i'm using **notify-send** to send notification on ubuntu and it works fine. after moving to Debian 12 KDE version, I found out that KDE has it's own notification handling program called **kdialog** so as other Desktop environments.

I tried installing notify-send in my debian KDE system using apt but no such package is available. I can only see notify-osd instead.

I'm looking for a way to send notifications using a common a program or a library like libnotify which is by default present in every linux distro so that I can run my tool on any distro without worrying about installing dependency for send notification.


Solution

  • What you need is called a "notification server" that handles notifications sent by applications or scripts via libnotify/notify-send.

    As you've stated, sometimes these are included in the DEs such as Gnome and KDE, but some other times, especially with other more minimalist DEs and WMs, a DE-independent notification server needs to be manually installed. Examples of these are notification-daemon and dunst. More examples can be found at the Arch Wiki.

    Unfortunately, this means there are no 100% surefire way to ensure your script will immediately works on any distro without any additional installation of notification servers.

    The good thing is both libnotify and most notification servers adhere to the same Desktop Notifications Specification so you can generally install any of the available notification servers, follow their configuration guides or manuals, and your script should work fine.