This is a simple Linux utility, written in Bash, to run notify-send on all users.
It includes the optional ability to queue notifications for offline individual users, that will be shown when they log in.
Notifications can also be sent to administrators only, depending on the given configuration.
# broadcast [a[a]][q][v] ARGUMENTS...
Where ARGUMENTS... are the usual arguments and options passed to notify-send. (See notify-send(1)).
The letters in the first (optional) argument to broadcast are flags that modify its behavior. They are as follows:
-
a— Send the notification to administrators only. Administrators are users belonging to any group listed inADMIN_GROUPSin the config. If specified twice (aa), users belonging inADMIN_EXTRA_GROUPSwill receive the notification as well. -
q— Queue notifications for offline users. -
v— Enable verbose output.
# broadcast --urgency=normal 'This is a summary!' 'This is the notification body.'
# broadcast q "If you're reading this right upon logon that means you've probably missed something important."
The configuration file is located at /etc/broadcast.conf and is self-documenting.
The broadcast-dequeue command is provided for users to receive missed notifications that were sent (with the broadcast q flag) when they were offline. A broadcast-dequeue.service systemd user unit is also included, that will run broadcast-dequeue upon logging into a graphical session.
The usage of broadcast-dequeue is described as follows:
$ broadcast-dequeue [v]
The v flag enables verbose output if supplied.
Queued notifications are stored in the file defined by QUEUE_FILE_PATH in the config. This defaults to ~/.broadcast.
notify-sendfrom libnotify, for sending the actual notifiationssudo, for executingnotify-sendas each target userpgrep, for getting currently running D-Bus session daemons
Feel free to submit bug fixes and feature( request)s.