Re: Sending notification

Il giorno mar, 24/05/2011 alle 13.12 -0400, Erick Pérez ha scritto:
> Hi:
> I want to know from the gnome-shell maintainers/developers
> Which is the preferred way of sending notifications in gnome-shell ?
> I can think of more than one, And some been hard than others to
> implement but, and that's why, there should be one way to do it
> according with the shell design, so again:
> Which is the preferred way of sending notifications in gnome-shell ?

What do you mean?

From an extension:
For short lived message, use
let source = new MessageTray.SystemNotificationSource();
let notification = new MessageTray.Notification(source, "Title",
"Content", { body: "Additional content that won't be shown in the
banner" });
For anything else, and in particular for things that should be
associated with objects (apps, people, folders, tasks...), write your
own Source class.
You find extensive docs in js/ui/messageTray.js, and examples in
NotificationDaemon, TelepathyClient and some extensions. It is extremely
flexible (in the end you can just replace the whole contents of the
notification and have your own widgets) and should be enough for

From an application:
Use libnotify. No other method is currently supported.
notify_init("Your App Name")
notification = notify_notification_new("Summary", "Content of the
notification", "face-smile");
notify_notification_show(notification, &error);
(There was discussion for allowing libappindicator, but it hasn't
happened yet)

If you want to do something more complex than that from an app, expose
your use case and we'll see about improving the API.


PS: if you're an app, and want a quick and dirty method for sending
complex notifications, without an extension, you can inject JS code with
org.gnome.Shell.Evaluate(s) -> (b, s) on /org/gnome/Shell at

Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]