Invoking the new NotifyOSD framework in C?

1k Views Asked by At

I want to make my GTK+ applications use the new notification area in Ubuntu. How can I do this? An example is shown below:


(source: iconocast.com)

1

There are 1 best solutions below

1
On BEST ANSWER

I'm not on an Ubuntu box so I can't write out any examples.

But Ubuntu's NotificationDevelopmentGuidelines page has a lot of information.

Examples in C, C#, and Python.

Debain also has a tutorial that should more or less have some commonality.

Basically your going to be tying into the NotifyOSD framework which leverages the Free Desktop Foundations D-Bus messaging system.

For development you'll need libnotify ( only online documentation I could find )

If you just want some quick results from the command line or to use in a shell script you can also use the notify-send command.

Usage:

notify-send [OPTION...] <SUMMARY> [BODY] 

Example:

notify-send Test "Totally gnarly message bro"

Or you can specify an icon:

notify-send -i ../icon.jpg  Image "This is a sweet picture"

There are a bunch of other options, expire time, urgency level, category.

Ubuntu doesn't follow the Notification specification that closely, they don't honor alot of the options defined by the FSF. Don't be surprised if some things don't work with ubuntu's notifier that you see working with another notifier system.

Some Other resources:

  • Ubuntu's NotifyOSD wiki page.
  • ArsTechnica has a great article on the new notification's system.
  • Great article on some of the flaws in Ubuntu's notification's implementation.