0

I'm writing a program which notify user about something repeatedly with new message each time using notify-send, but the problem is I want notifications to stay there for 5 seconds but it should be removed or deleted whenever new notification is created from notify-send.

Dheerendra
  • 111
  • 4

1 Answers1

1

notify-send does take a -t argument for time:

-t, --expire-time=TIME
Specifies the timeout in milliseconds at which to expire the notification.

But you're at the mercy of whatever handles the notifications as to whether or not that's implemented.

I tried it on KDE with notify-send -t 5000 test and the notification was on the screen for only three seconds. This may work in Ubuntu proper with notify-osd but it may not. If you want to be certain, you'll have to implement your own notification system.

Oli
  • 289,791
  • 117
  • 680
  • 835
  • I think this is still the case in Ubuntu: http://askubuntu.com/questions/110969/notify-send-ignores-timeout I tried to set it without succes. – Jacob Vlijm Dec 18 '14 at 09:14
  • Thanks @JacobVlijm! That makes sense. I notice that [the bug report for this against `notify-osd` got a `wontfix`](https://bugs.launchpad.net/ubuntu/+source/notify-osd/+bug/390508). It seems like a design decision to stop things hogging the screen excessively. – Oli Dec 18 '14 at 09:17
  • Seems to work on XFCE, `notify-send -t 10000` stays up for about 10 seconds, plus the "minimum" time of about 1.5 seconds. `-t 5` still stays for 1.5 seconds too. – Xen2050 Dec 18 '14 at 15:17