Ubuntu – How to clear system tray notification via command line

bashgnomenotification-area

I have an application which produces system notification every 5 seconds.

Overtime the notification tray I have (Gnome env) gets crowded.

How can I clear it like every minute but I need to do this via bash so that I can automate it later.

EDIT

I think I haven't made my question clear hence this edit.

I want to see the notifications. But as this is in GNOME env it gets accumulated in the notifications tray unless manually cleared.

I don't want to clear it manually… I want to clear it automatically after every 1 min. So I am looking for a way to do that from the command line so that I can later on code that into my application

Hope I have made my question clear…

Best Answer

If you wrote the application, you could just put a timeout on the notifications:

notify-send -t 5000 "Title" "Details"

If not, the only way I know of would be to restart the gnome desktop. You can do it by pushing Alt + F2, type "r" then Enter. But if you want to do it via command line:

killall -3 gnome-shell

Unfortunately the kill gnome option will interfere if you want to keep using applications during the flickery restart of gnome-shell.