Unable to lower notification's expiry time than ten seconds

Bug #423314 reported by agaric
42
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Debian
Fix Released
Unknown
notify-osd (Ubuntu)
Invalid
Wishlist
Mirco Müller

Bug Description

I want to create customised notifications to be shown by "notify-osd", using, for example, Python's "pynotify" module or the "notify-send" program.
I've noticed that the default expiration time of "notify-osd" is 10 seconds.
Wanting notifications that last shorter, I tried to set lower expire-times and urgency-levels. But whatever expire-times (100ms, 1sec, 5sec) or urgency-levels (low, normal) I specify are all ignored, and the notification goes on notifyin' for 10 seconds.

example usages that don't work as expected:
--- with "pynotify":
n = pynotify.Notification("This is a short notice")
n.set_urgency(pynotify.URGENCY_LOW)
n.set_timeout(1000)
n.show()

--- with "notify-send":
# notify-send -u low -t 1000 "This is a short notice"

* I'm running debian testing (amd64), and using software packaged for debian.
used software and versions:
- notify-osd 0.9.18-1
- libnotify1 0.4.5-1
- libnotify-bin 0.4.5-1 (notify-send)
- python-notify 0.1.1-2+b1 (pynotify)
- openbox 3.4.7.2-5 (window manager)

description: updated
Mirco Müller (macslow)
Changed in notify-osd:
status: New → Won't Fix
importance: Undecided → Wishlist
Revision history for this message
Mirco Müller (macslow) wrote :

Bin Joo, it is part of the design of notify-osd to not allow external definition of timeouts for notifications (to protect the user from notification-spam). You can read more about this here: https://wiki.ubuntu.com/NotifyOSD.

In addition to that following the development guidelines of the notification-spec, http://www.galago-project.org/specs/notification/0.9/index.html, you should check a notification servers capabilities using the GetCapabilities call and only use features based on the reply you get. Example code (C, C#, Python) for dealing with notify-osd's capabilities you can find in the examples folder of notify-osd trunk (bzr branch lp:notify-osd).

Some parts of the implicit timing set forth by a notifications urgency are not yet implemented in notify-osd.

Changed in notify-osd:
status: Won't Fix → Invalid
assignee: nobody → Mirco Müller (macslow)
Revision history for this message
Steve Dodier-Lazaro (sidi) wrote : Re: [Bug 423314] Re: Unable to lower notification's expiry time than ten seconds

Mirco, the NotifyOsd spec says that the duration should be 5s + 250ms per
body line for async non critical bubbles, and apparently the bug report also
mentions that they are of 10 seconds instead of 5.

Changed in debian:
status: Unknown → New
Revision history for this message
Mirco Müller (macslow) wrote :

Steve, that's why I mentioned "Some parts of the implicit timing set forth by a notifications urgency are not yet implemented in notify-osd" in comment #1. See also https://wiki.ubuntu.com/NotifyOSD#Animations%20and%20durations

Revision history for this message
Steve Dodier-Lazaro (sidi) wrote :

Ew, sorry. That'll teach me to not only read the last comments. :)

Revision history for this message
Dana Goyette (danagoyette) wrote :

Hmm, is there ANY way to get notify-send not to make my notifications show up for a full 10 seconds? I have a script bound to my "toggle ambient light sensor" key that gives this short notification:

"Ambient Light Sensor"
"ON"

I can read those 4 words about 20 or 50 times in the ten seconds the bubble remains on the screen.
(In Windows, the equivalent notification from HP's utilities show up for, oh, 3/4 second -- so even the expected 5 seconds is way too long.)
If I hit the key twice, they get backlogged for 20 seconds... ridiculous! Is there any way to get notify-osd to do this "update" operation that we're supposed to use?

Changed in debian:
status: New → Fix Released
Revision history for this message
frizzle21 (frederik-nnaji) wrote :

why not let the user contribute to the development of the "notification
system", by giving the user more hands on control for now!?

On Tue, Feb 2, 2010 at 18:10, Bug Watch Updater <<email address hidden>
> wrote:

> ** Changed in: debian
> Status: New => Fix Released
>
> --
> Unable to lower notification's expiry time than ten seconds
> https://bugs.launchpad.net/bugs/423314
> You received this bug notification because you are subscribed to The
> Ayatana Project.
>
> Status in Notify OSD: Invalid
> Status in Debian GNU/Linux: Fix Released
>
> Bug description:
> I want to create customised notifications to be shown by "notify-osd",
> using, for example, Python's "pynotify" module or the "notify-send" program.
> I've noticed that the default expiration time of "notify-osd" is 10
> seconds.
> Wanting notifications that last shorter, I tried to set lower expire-times
> and urgency-levels. But whatever expire-times (100ms, 1sec, 5sec) or
> urgency-levels (low, normal) I specify are all ignored, and the notification
> goes on notifyin' for 10 seconds.
>
>
> example usages that don't work as expected:
> --- with "pynotify":
> n = pynotify.Notification("This is a short notice")
> n.set_urgency(pynotify.URGENCY_LOW)
> n.set_timeout(1000)
> n.show()
>
> --- with "notify-send":
> # notify-send -u low -t 1000 "This is a short notice"
>
>
> * I'm running debian testing (amd64), and using software packaged for
> debian.
> used software and versions:
> - notify-osd 0.9.18-1
> - libnotify1 0.4.5-1
> - libnotify-bin 0.4.5-1 (notify-send)
> - python-notify 0.1.1-2+b1 (pynotify)
> - openbox 3.4.7.2-5 (window manager)
>
>
>

Revision history for this message
Peter Rhone (prhone-gmail) wrote :

This is super annoying. I have a custom script to set the screen brightness on my sony vaio laptop (FN keys don't work), and changing brightness displays each incremental step for a full 10s. This situation is completely untenable. Is there an alternative to onscreen-osd (I'm calling notify-send with -t) that doesn't display marginally interesting info for minutes instead of fractions of seconds? The offending script is called by a keybinding and looks like this:

#!/bin/bash
level=`xbacklight -get`
level=${level/.*}
if [ $level -eq 0 ]
then inc=30
else inc=20
fi
level=$(echo "scale=1; $level+$inc" | bc)
if [ $level -gt 100 ]
then
level=100
fi
xbacklight -set $level
notify-send -t 500 -i brightness_icon "Brightness $level %"

Revision history for this message
kazzmir (rafkind) wrote :

The attached patch makes notify-osd respect the -t flag from notify-send. There might be a cleaner way to do this but it seems to work.

I created this patch based on bzr revision 433.

Revision history for this message
kazzmir (rafkind) wrote :

I can't tell if launchpad added my patch or not so I will try again and copy/paste the raw text here.

=== modified file 'src/bubble.c'
--- src/bubble.c 2010-10-21 17:02:54 +0000
+++ src/bubble.c 2011-05-09 03:25:20 +0000
@@ -2182,7 +2182,7 @@
 //-- public API ----------------------------------------------------------------

 Bubble*
-bubble_new (Defaults* defaults)
+bubble_new (Defaults* defaults, gint timeout)
 {
  Bubble* this = NULL;
  GtkWidget* window = NULL;
@@ -2257,7 +2257,12 @@
  this->priv->icon_pixbuf = NULL;
  this->priv->value = -2;
  this->priv->visible = FALSE;
- this->priv->timeout = 5000;
+ if (timeout != -1){
+ this->priv->timeout = timeout;
+ } else {
+ /* old default value */
+ this->priv->timeout = 5000;
+ }
  this->priv->mouse_over = FALSE;
  this->priv->distance = 1.0f;
  this->priv->composited = gdk_screen_is_composited (

=== modified file 'src/bubble.h'
--- src/bubble.h 2010-10-21 16:52:42 +0000
+++ src/bubble.h 2011-05-09 03:24:40 +0000
@@ -86,7 +86,7 @@
 GType bubble_get_type (void);

 Bubble*
-bubble_new (Defaults* defaults);
+bubble_new (Defaults* defaults, gint timeout);

 gchar*
 bubble_get_synchronous (Bubble *self);

=== modified file 'src/display.c'
--- src/display.c 2009-10-20 08:51:11 +0000
+++ src/display.c 2011-05-09 03:25:50 +0000
@@ -310,8 +310,9 @@
   return;
  }

- bubble_set_timeout (bubble,
- defaults_get_on_screen_timeout (self->defaults));
+ bubble_set_timeout (bubble, bubble_get_timeout(bubble)
+ // defaults_get_on_screen_timeout (self->defaults)
+ );

  defaults_get_top_corner (self->defaults, &x, &y);

=== modified file 'src/stack.c'
--- src/stack.c 2009-10-20 08:51:11 +0000
+++ src/stack.c 2011-05-09 03:24:31 +0000
@@ -579,7 +579,7 @@
  GdkPixbuf* pixbuf = NULL;
  gboolean new_bubble = FALSE;
  gboolean turn_into_dialog;
-
+
  // check max. allowed limit queue-size
  if (g_list_length (self->list) > MAX_STACK_SIZE)
  {
@@ -623,7 +623,7 @@
  {
   gchar *sender;
   new_bubble = TRUE;
- bubble = bubble_new (self->defaults);
+ bubble = bubble_new (self->defaults, timeout);
   g_object_weak_ref (G_OBJECT (bubble),
        _weak_notify_cb,
        (gpointer) self);

affects: notify-osd → notify-osd (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.