3

Some scripts I wrote show notifications like "Volume up" or "Reset brightness" for example, using notify-send. However, the notifications get saved in the notification menu on Ubuntu 18.04, which I don't want since there are so many repeats. How do I prevent that?


Here's what I tried:

  • Checked man notify-send but didn't see any options about not saving the notification.
  • notify-send --urgency=low - no difference
  • Researched "gnome toast notifications" but apparently they're application-specific, which doesn't work for me
  • Considered using Zenity but I couldn't find a way to make a notification that doesn't steal focus.
  • In Python, making a Notify.notification object .show() twice - no difference

1 Answer 1

6

You can send a transient notification with notify-send using the -h (hint) option like this:

notify-send -h int:transient:1 "Hello" "World"

Hints are a way to provide extra data to a notification server that the server may be able to make use of. From man notify-send

-h, --hint=TYPE:NAME:VALUE
       Specifies basic extra data to pass. Valid types are int, double, string and byte.

Check this out (external link to developer.gnome.org) for some standard hints. The transient hint is described as follows:

When set the server will treat the notification as transient and by-pass the server's persistence capability, if it should exist.

2
  • Thanks! This is exactly what I wanted! Though I just noticed I still have some noisy notifications from Clementine. Would you know anything making Clementine's notifications transient? I'll probably open a new question about it.
    – wjandrea
    Nov 13, 2019 at 22:17
  • Or maybe I'll just disable Clementine notifications... I'll get back to you. But I found this btw if you're curious: askubuntu.com/a/109133/301745
    – wjandrea
    Nov 13, 2019 at 22:22

You must log in to answer this question.

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