Package: notify-send.py
A python script for sending desktop notifications from the shell.AboutLibnotify is part of many scripts in the Linux world. It utilizes many
of the specified features of the Desktop Notifications Specification
and makes them accessible to shell-scripts. It doesnothowever
allow to replace an existing notification with thereplaces-id. This
is a knownbugsince 2008 and has apatchsince 2012. The patch is still not
upstream though (2018).This python script utilizes thenotify2package and exposes the
functionality to the shell.Differences between notify-send.py and notify-sendInnotify-send.py-hshows help instead of being the parameter for
hints. For hints use--hint.Innotify-send.py-rIDandnotify-send.py--replaces-idIDexists. In order to replace a notification callnotify-send.pywith the ID that was returned by the notification to be replaced.notify-send.pyreturns the ID of the newly created notification.notify-send.py--replaces-processNAMEexists.
Every notification that gets created with the same NAME will replace
every notification before it with the same NAME. If called with this
parameternotify-send.pymight block, best to be called with a
trailing&.notify-send.pyhas action-support (buttons). Trynotify-send.py"Yes orno?"--actionok:OK cancel:CancelInstallationRequires python 3.From PyPI:pipinstallnotify-send.pyFrom repo:gitclonehttps://github.com/phuhl/notify-send.pycdnotify-send.pypipinstall.Usage$notify-send.py-husage: notify-send.py [-h] [-u LEVEL] [-t TIME] [-a APP_NAME]
                      [-i ICON[,ICON...]] [-c TYPE[,TYPE...]]
                      [--hint [TYPE:NAME:VALUE ...]] [-r ID]
                      [--replaces-process NAME] [--action [KEY:NAME ...]]
                      [--dontQuitOnAction]
                      SUMMARY [BODY]

positional arguments:
  SUMMARY               Summary of the notification. Usage of \n and \t is
                        possible.
  BODY                  Body of the notification. Usage of \n and \t is
                        possible.

optional arguments:
  -h, --help            show this help message and exit
  -u LEVEL, --urgency LEVEL
                        Specifies the urgency level (low, normal, critical).
  -t TIME, --expire-time TIME
                        Specifies the timeout in milliseconds at which to
                        expire the notification.
  -a APP_NAME, --app-name APP_NAME
                        Specifies the app name for the icon
  -i ICON[,ICON...], --icon ICON[,ICON...]
                        Specifies an icon filename or stock icon to display.
  -c TYPE[,TYPE...], --category TYPE[,TYPE...]
                        Specifies the notification category.
  --hint [TYPE:NAME:VALUE ...]
                        Specifies basic extra data to pass. Valid types are
                        int, double, string, boolean and byte.
  -r ID, --replaces-id ID
                        Specifies the id of the notification that should be
                        replaced.
  --replaces-process NAME
                        Specifies the name of a notification. Every
                        notification that gets created with the same NAME will
                        replace every notification before it with the same
                        NAME.
  --action [KEY:NAME ...]
                        Specifies actions for the notification. The action
                        with the key "default" will be dispatched on click of
                        the notification. Key is the return value, name is the
                        display-name on the button.
  --dontQuitOnAction    Keeps running until the notification has been closed,
                        instead of stopping after the first action was
                        received.notify-send[.py] as root userIn order to display notifications, even if libnotify ornotify-send.pyis used from the root user this script is helpful.
You need to customize it with your username and userid (which probably is
1000 but can be found out by runningcat /etc/passwd | grep <username>).notify-send-from-root.sh:#!/bin/bashUSERNAME=<yourusernamehere>USERID=1000exportXAUTHORITY=/home/$USERNAME/.XauthorityexportDISPLAY=:0exportDBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$USERID/busif["$(/usr/bin/id-u)"!="$USERID"];thensudo-u$USERNAMEXAUTHORITY=/home/$USERNAME/.XauthorityDISPLAY=:0DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$USERID/bus/usr/bin/notify-send.py"$@"else/usr/bin/notify-send.py"$@"fiExamples (Volume and Brightness pop-ups)Volume control-pop-ups:https://github.com/phuhl/linux_notification_center#example-volume-indicatorBrightness control-pop-ups:https://github.com/phuhl/linux_notification_center#example-brightness-indicatorSee alsoAlso take a look at mynotification-daemoninspired byDunst, but with several improvements, including the possibility of a transparent background and a notification center that stores notifications.