LinuxCommandLibrary

notify-send

Display desktop notifications

TLDR

Show a notification with the title "Test" and the content "This is a test"

$ notify-send "[Test]" "[This is a test]"
copy

Show a notification with a custom icon
$ notify-send [[-i|--icon]] [icon.png] "[Test]" "[This is a test]"
copy

Show a notification for 5 seconds
$ notify-send [[-t|--expire-time]] 5000 "[Test]" "[This is a test]"
copy

Show a notification with the specified urgency level (default: normal)
$ notify-send [[-u|--urgency]] [low|normal|critical] "[Test]" "[This is a test]"
copy

Show a notification with an app's icon and name
$ notify-send "[Test]" [[-i|--icon]] [google-chrome] [[-a|--app-name]] "[Google Chrome]"
copy

SYNOPSIS

notify-send [OPTIONS]

[BODY]

PARAMETERS

-u, --urgency=LEVEL
    Specifies the urgency level of the notification. LEVEL can be 'low', 'normal', or 'critical'.

-t, --expire-time=TIME
    Sets the timeout for the notification in milliseconds.

-i, --icon=ICON
    Specifies the icon to display with the notification. ICON can be a filename, a stock icon name, or a theme icon name.

-c, --category=CATEGORY
    Specifies the category of the notification.

-a, --app-name=NAME
    Specifies the application name for the notification.

-h, --hint=TYPE:NAME:VALUE
    Specifies a hint. TYPE can be int, double, string, byte, or bool. NAME is the hint name, and VALUE is the hint value. This option can be given multiple times.

-v, --version
    Displays the version information.

-?
    Show help options

DESCRIPTION

The notify-send command sends desktop notifications to the user via the D-Bus notification server. This command allows scripts and programs to display transient, non-intrusive messages on the user's desktop, without interrupting their workflow. Notifications can include a summary (title), a body (content), and an optional icon. These notifications are typically displayed in the corner of the screen and automatically disappear after a short period, or can be manually dismissed by the user.

notify-send is commonly used for alerting users about events, status updates, or important information that does not require immediate attention. The notifications system supports a broad range of options to customize the visual and behavioral aspects of the notification, such as urgency levels, icons, and timeouts. These adjustments are available when crafting notification messages.

CAVEATS

The availability and appearance of notifications depend on the desktop environment and notification server in use. Some desktop environments may have different ways of handling notifications, or may not support all features of notify-send.

EXAMPLES

  • Send a simple notification:
    notify-send "Hello" "This is a notification message."
  • Send a notification with a critical urgency:
    notify-send -u critical "Warning" "Low disk space!"
  • Send a notification with an icon:
    notify-send -i /path/to/icon.png "Attention" "New message received."
  • Send a notification with a timeout of 5 seconds (5000 milliseconds):
    notify-send -t 5000 "Info" "System is updating..."

HISTORY

notify-send was originally developed as part of the libnotify library, which provides a standardized way for applications to send notifications on Linux and other Unix-like systems. The command-line utility notify-send provides a convenient way to trigger these notifications from scripts or the command line. Its adoption has grown with the increasing use of desktop environments that implement notification standards, making it a valuable tool for system administrators, developers, and end-users alike.

SEE ALSO

dunst(1), xfce4-notifyd(1)

Copied to clipboard