I want to display my desktop notifications (I'm using Gnome 3) on some other device. So I want to write a software that gets the notification on my computer and sends it over the internet. Unfortunately, I didn't find any good point to start on how my code can get the notifications and do something with them.

Is there some API for it?

  • This is a little confusing for me. Are you asking about how to change the location of gnome notifications or just how to send desktop notification from your own programs? (or both?)
    – grochmal
    Commented Aug 21, 2016 at 19:39
  • @grochmal I clarified it. I want to write a software that reads the notifications on my computer and sends them via network to some other device.
    – Florian
    Commented Aug 21, 2016 at 23:40

1 Answer 1


Well, Gnome notifications use D-BUS to pass the messages around. The gnome specification describes how to use the org.freedesktop.Notifications.* classes and has a good deal of formatting tips. In general it is a HTML-ish format.

Yet, you absolutely cannot talk to the D-BUS on another machine remotely. Let's not even start on how many security holes that would open.

Still, you can always have a program on the target machine that will receive the communication and talk to D-BUS locally already in there.

There are two options that are wrappers around org.freedesktop.Notifications.* and make writing programs much easier:

  • libnotify: which is almost a de-facto standard for making notifications, supports not only gnome but several others.
  • notify-sharp-3: as strange as it may sound it is an open-source C# based functionality around several notification specs. At some point it even had its own language called boo, but it is kind of dying out in favour of libnotify.

OK, libnotify we go.

libnotify comes with a binary that knows how to talk with the notification daemon (yes, those notifications are displayed by a background daemon). The command is notify-send, and it is rather trivial to use.

notify-send 'Meeting in 5 minutes' 'John from the <b>QA Team</b> just found a bug that should never had happened.  Seriously, we are doing something wrong'

And that will display the notification. Yet, making it remote is a little more complex. Assuming that you know that bob is the user currently running Xorg at machine krakatoa and that krakatoa has libnotify installed and is running gnome notify daemon you can do:

ssh bob@krakatoa \
    notify-send 'Meeting in 5 minutes' \
    'John from the <b>QA Team</b> just found a bug that should never had happened.  Seriously, we are doing something wrong'

But finding each user on each machine may be tricky. You may try to create a script that will perform ps -afe | grep gnome, find the user and run su -u <user> DISPLAY=:0 notify-send .... But then again, you probably should not send ssh requests as root in the first place.

The Arch wiki has a list of interfaces to libnotify in several languages. From there you can create your own daemon, with your own communication protocol for the notification messages. For example, since you are specifically after gnome, python Gobject may just fit the bill.

In summary:

  • Notifications happen on D-BUS;
  • You cannot directly access D-BUS remotely;
  • You can use libnotify to access D-BUS from a program under your control on the target machine.


  • If daemon is running as root, it does not have access to dbus. Is there any fix in libnotify-dev(c++ implementation) to send notification from root to all the users.
    – vkg
    Commented May 20, 2021 at 19:29
  • 1
    @vkg by definition there is none. If you want to interact between users the onus of writing the software is on you. Notably, if you want a channel between a user and a daemon running as root is is a particularly dangerous endeavor and needs very careful - and documented - behaviour on the decisions you took about the communication. No library will ever take on that, and if a library will no one in their sane mind will use it.
    – grochmal
    Commented Sep 3, 2021 at 14:43
  • In case it's not obvious, it has the name libnotify-bin on some package managers. For example, on Debian it's sudo apt install libnotify-bin
    – Seth Falco
    Commented May 15, 2022 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .