7

I'm writing a shell script from which I'd like to display a desktop notification which stays in one corner of the display until the user clicks on it, and if multiple notifications are sent, then all of them are displayed and visible at the same time in one on the screen. I've tried notify-send, which worked perfectly on Ubuntu Hardy, but it cannot do what I need on Ubuntu Lucid. What should I use instead?

I've also tried pynotify (python-notify) and libnotify, but they all seem to use the same backend, which cannot do what I want by default.

I've tried

$ notify-send foo

, but it displays a notification which times out after a few second (not good), and

$ notify-send -t 0 foo

displays a notification in a window in the middle of the screen (not good). If I do

$ notify-send foo
$ notify-send bar

only one of the notifications are displayed at the same time (not good).

After some more digging I've found:

1 Answer 1

5

It seems that notify-osd is the new Ubuntu notification daemon which can't do what I want, and notification-daemon is the one I need, the one which was the default in previous Ubuntu versions like Hardy. Here is how to install it and make it the default on Ubuntu Lucid:

$ sudo apt-get install notification-daemon
$ sudo perl -pi -e 's@^Exec=.*@Exec=/usr/lib/notification-daemon/notification-daemon@' /usr/share/dbus-1/services/org.freedesktop.Notifications.service
$ sudo killall notify-osd

Optional:

$ sudo rm -f /usr/share/dbus-1/services/org.freedesktop.Notifications.service.*

Now this works as intended:

$ notify-send -t 0 foo

To revert the changes run:

$ sudo apt-get install --reinstall notify-osd
5
  • 1
    How does this fix affect other apps? Dec 14, 2010 at 14:59
  • All apps would send their notification to notification-daemon.
    – pts
    Jan 9, 2011 at 17:42
  • Multiple notifications seems not to be supported. How can I revert the changes? Jun 18, 2014 at 5:59
  • For me, multiple notifications are supported on Ubuntu Lucid. To revert the changes, do a sudo apt-get install --reinstall ... on all packages containing all changed files. (Use dpkg -S ... to find out which packages contain which files.)
    – pts
    Jun 18, 2014 at 8:09
  • 1
    @pts Thanks! $ sudo apt-get install --reinstall notify-osd worked for me. Jun 24, 2014 at 13:29

You must log in to answer this question.

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