Send notifications with notify send
Send notifications with notify-send
Simple Notification
notify-send 'Title' 'Text of the message'
Fig: Simple desktop notification
Notification with an icon
notify-send can be used to send notification with an icon using -i
option
notify-send -u critical -i "firefox" 'Title' 'Text of the message'
Notification with custom icon
You can use your own custom icon using the notify-send -i option as shown below.
notify-send -i ~/test/java.png 'Hello World!!'
Notification with output of command
notify-send 'ls example' "`ls /boot`"
Notification after command execution
To notify only if the command execution succeeds, use &&.
command && notify-send
To notify after a command (or shell-script, or background job) is completed, without worrying whether the commands succeeded or failed use ;.
long job ; notify-send
This method is extremely helpful when you are executing a long running shell-script in the background and you would like to be notified with a little nice non-intrusive pop-up when the job is completed.
Urgency level
You can specify an urgency level with -u
or --urgency=LEVEL
.
Levels can be used:
- low
- normal
- critical
Expire time
Set the timeout in milliseconds at which to expire the notification using -t
or --expire-time=TIME