Join us for the next conference in 2027!
Notifications in GNU/Linux

Notifications in GNU/Linux

November 3, 2023

Installation

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

Installation with apt

# debian/ubuntu
sudo apt install libnotify-bin

Installation with dnf

# redhat/fedora
sudo dnf install libnotify

Usage

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

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>
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.

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

Links