27

Is there a way to change how long the libnotify notifications last? I've googled around for this for months and no still no luck.

I'm actually starting to think that you can't change it. I can't even find anywhere in the API where developers can control this.

8128
  • 28,868

3 Answers3

14

You can't do this normally. However, there is a patched version of notify-osd that supports it:enter image description here

From Ubuntu 16.04 onwards:

You'll need to add two PPA's:

sudo add-apt-repository ppa:leolik/leolik
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt update

Then install it like this:

sudo apt-get upgrade
sudo apt-get install notifyosdconfig

The configuration dialog should be in Applications->Accessories or notifyosdconf from the terminal. There's a setting for the standard notification duration as per screenshot above if you don't set it the --expire-time parameter.

Example:

notify-send --urgency=LOW --expire-time=1 --icon=face-laugh "test" "1 second"

Older versions: (9.10-14.10)

You'll need to add two PPA's:

sudo add-apt-repository ppa:leolik/leolik
sudo add-apt-repository ppa:amandeepgrewal/notifyosdconfig
sudo apt-get update

Then install it like this:

sudo apt-get upgrade
sudo apt-get install notifyosdconfig

The configuration dialog should be in Applications->Accessories or notifyosdconf from the terminal. There's a setting for notification duration as per screenshot above.

Example:

notify-send --urgency=LOW --expire-time=1 --icon=face-laugh "test" "1 second"
dieki
  • 3,412
4

crude but effective and then some - caveat this also kills pending notifications
this can only shorten display times just change the 1.5 in sleep 1.5; below:

ref:
details in Close button on notify-osd?

x-ref:
Expiry time in notify-send notifications

dbus-monitor "interface='org.freedesktop.Notifications'"            \
| grep --line-buffered  "member=Notify"                             \
| sed -u -e 's/.*/sleep 1.5; killall notify-osd/'                   \
| bash

Bookmarks:
self - How do I change how long notifications are displayed?
Expiry time in notify-send notifications

3

The duration of the notification is, I believe, dependent on the length of the message.

From the perspective of someone who was worked with it indirectly (by using the pynotify module in Python), I have discovered that specifying a duration for a message is not possible.

Nathan Osman
  • 32,495