Ubuntu: How can I send a custom desktop notification?



Question:

I have a custom script and I want to send a desktop notification (the one that appears in the top right corner of the screen) with a custom message. How do I do that?


Solution:1

There is bunch of other cool features with notify-send

We can run a command and make it display in the notification:

notify-send <title> <`command`>  notify-send Date "`date`"  notify-send Disk "`df / -H`"  

We can use icons with the notifications

notify-send -i <icon> <Message>  notify-send -i face-wink "Hello! January"  

Really annoying pop up

notify-send  -t 0 "Bringing down the system"  

and

notify-send <title> <message>  notify-send "who am i" "I am January"  

For more options check here


Solution:2

Just to add to the other answers, when running the command locally from cron, I use

DISPLAY=:0.0 /usr/bin/notify-send "TITLE" "MESSAGE"  


Solution:3

I stumbled upon that one by chance. Answer: use the program notify-send:

notify-send "Hello world!"  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »