Notify-Send: Set Custom Desktop Notifications in Ubuntu

Notify-send is a small, simple built-in application that lets users set custom desktop notifications via command-line or shell scripts. It is included in almost all Debian-based distributions.

It’s a simple notification displaying an application that doesn’t show any button, just a simple message that disappears within a second if custom time is not set.

Many similar applications are available, like noti, but notify-send is pretty easy to learn and implement in your shell script.

While writing this article, v0.7.9 is the latest version of notify-send. You can check your version using the below command.

$ notify-send -v

Create Custom Notification

Create a simple notification that displays “Good Morning TREND OCEANS Army” in notify-send.

$ notify-send "Good Morning TREND OCEANS Army"
Create Simple Custom Notification
Create Custom Notification

Create Custom Notification with Title

The custom title can be set along with a message which will be displayed at the time of the notification popup.

Here we set the same message with the title “Wishing”.

$ notify-send "Wishing" "Good Morning TREND OCEANS Army"
Create Simple Custom Notification with Title
Create Custom Notification with Title

Create Notification with Icon

We can also set custom icons that appear in the right position at the notification popup, like the custom titles.

Provide the full path of the icon after -i option and make sure your icon is in png format.

$ notify-send -i "/home/kakarot/linux.png" "Good Morning TREND OCEANS Army"
Create Notification with Icon
Create Notification with Icon

Create Notification with App’s Icon

You can specify the app’s icon as a notification icon. For example, want to use a chrome icon, what is the execution name from the terminal for chrome google-chrome.

Just specify that app name after –icon option in the terminal.

$ notify-send "Good Morning TREND OCEANS Army" --icon=google-chrome
Create Notification with App Icon
Create Notification with App’s Icon

Set Custom Timeout of Notification

By default custom timeout of notification is 5 seconds, but you can manually change it according to your own needs.

Specify your timeout in a millisecond after -t option.

Set Custom Timeout of Notification
Set Custom Timeout of Notification

Show Notification Once System Fully Updated

Commands like update and upgrade or any app install take some time, and you have to wait while they are fully installed in your system to execute another application.

While this process takes time, you manually check whether command execution is completed or not. So, you can attach notify-send with your command. Once execution is completed, it will pop up a notification.

Below I have attached the notify-send with the update command.

$ sudo apt update && notify-send "Updated"
Show Notification Once System Fully Updated
Show Notification Once System Fully Updated

Final Thought

I hope you enjoyed learning this small but useful application. If you have any queries regarding this application or require help, let us know in the comment section.

Leave a Reply