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
pomsky
  • 70,557
wjandrea
  • 14,504

1 Answers1

7

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.

pomsky
  • 70,557