Notifications in GNU/Linux

Installation #

1
2
notify-send
# Command 'notify-send' not found, but can be installed with:

Installation with apt #

1
2
# debian/ubuntu
sudo apt install libnotify-bin

Installation with dnf #

1
2
# redhat/fedora
sudo dnf install libnotify

Usage #

1
2
notify-send "this is the summary"
notify-send "this is the summary" "this is the body of the notification"

Send to remote machine over SSH #

1
ssh user@host 'DISPLAY=:0 notify-send "TEST MESSAGE."'

Styling with HTML #

HTML tags are supported for styling the notification messages, even including images, although the result is not styled in the case of notifications in the rofication setup used by default in the i3wm-based regolith-desktop DE.

Bold Text <b>Bold Text</b>
Italic Text <i>Italic Text</i>
Underlined <u>Underlined</u>
Links <a href="/posts/notify-send">Links</a>
images <img src="image.png">Alt Text</img>
1
notify-send "this is the summary" "<b>Hey</b> <i>look</i> at <a href="/posts/notify-send">this</a>"

Urgency #

Available levels of urgency:

  • critical
  • normal
  • low

Specify either -u or --unique flags and one of the options listed above. Like the HTML styling above different desktop environments may treat these levels differently or ignore them all-together.

Temporary notifications #

Specify either -t or --expire-time flags and a value in milliseconds, although (again), different environments tend to respect this differently, and sometimes alternately depending on the level of urgency set.

1
notify-send -u critical -t 500 "Critical notification!" "this is the body of the notification"