← Back to team overview

unity-design team mailing list archive

Re: Notification design problem

 

This is all intended behaviour. A lot of it is explained in the wiki,
at https://wiki.ubuntu.com/NotifyOSD and
https://wiki.ubuntu.com/NotificationDesignGuidelines. You can find the
rationale, as well as some advice on how to do pretty well any kind of
notification.

On Wed, Sep 19, 2012 at 10:52 AM, Gregory Merchan
<gregory.merchan@xxxxxxxxx> wrote:
>
> I ran into a problem with the notification system, given its design.
>
> Here's what I was doing: I have a program which reads information from
> somewhere and notifies me of it, subject to some conditions, using
> `notify-send`. I use `watch` to run it regularly. I accidentally set
> it to run every 2 seconds, instead of every 2 minutes, and before I
> stopped it, multiple messages had been queued. I know this not because
> I was able to see the queue, but because the same notice kept
> appearing for more than minute after I stopped the watch.
>
> There are two problems here.
>
> 1) The notifications should have come within about 2 seconds of each
> other, but the time was much longer as each stayed on the screen for a
> while before it faded and the next one appeared. If I needed to
> receive some notification in a timely manner, I would not have because
> of the slowly moving queue.

Normally, you would solve this by updating or appending your existing
notification. However, notify-send is unable to do this. I believe
there is a modified version of notify-send which can (by returning a
unique identifier for the created notification, which can be passed to
the command later as a hint). However, depending on the complexity of
this program, you might be better off writing it with Python or
something so you can talk to the libnotify library directly.

Here is an example:

#!/usr/bin/python
from gi.repository import Notify
import time
Notify.init("Notification example")
notification = Notify.Notification.new("Example notification", "This
is your initial notification.", None)
notification.show()
time.sleep(3)
notification.update("Replacement notification", "This is a
notification that supercedes the first one.", None)
notification.show()

>
> 2) I knew there were a bunch of notifications queued and I couldn't do
> anything about it. I couldn't dismiss the notices, see the queue,
> dismiss the queue, or anything. I had to wait and wait for all the
> messages to go through.

There are a few things here:

Applications should not be blasting you with notifications. (If one
is, that's a bug). A notification is not a pretty box at the top right
corner of the screen that an application can jam its user interface
into. It's a notification, in the sense of your toaster making a ping
sound when it is finished making toast (except here you get a ping and
some text).

With that solved, there should be no need for a queue because
applications will be using notifications _to notify_ while providing
persistent status information in other ways. For example, in the
message indicator, in the application's own interface, or in Unity's
launcher.

Meanwhile, applications that want to provide urgent information will
find some trouble here, and that is intentional. If notifications
aren't working as you want them, it's a hint that you are better off
notifying the user in some other way. That's where the Notification
Design Guidelines wiki page is very helpful. If your notification is
more important than any other notification, it isn't a notification:
it's an alert. You can create an alert box using Zenity, and it will
appear on its own terms ;)

I hope that helps!

Dylan


Follow ups

References