While installing docker, I decided I needed to write some notifications to ensure the configuration works. See Docker. I started with a TCL/TK script, which these days looks a bit old school, and writing the packer was (& remains) difficult. Virtualbox reports its status on Ubuntu via a very pretty interface, prettier than Apple script anyway, so I thought I’d have a lock. This page contains the original notes in Ubuntu and Docker and has been supplemented by notes on Elementary and Raspbian. This seems easiest to use on Gnome/Ubuntu. There is a message sender i.e. notify-send, and a notification daemon and obviously a desktop.
The command is notify-send
. This is part of the desktop, obviously not needed if running headless.
- http://manpages.ubuntu.com/manpages/trusty/man1/notify-send.1.html – the man page
- http://www.linuxjournal.com/content/tech-tip-get-notifications-your-scripts-notify-send – some examples
- http://ubuntuforums.org/showthread.php?t=1411620 – an ubuntu forums thread with some tips
With Ubuntu, it is part of a notification system which offers a cool look and feel and message storage and display through the desktop panel. It comes with some standard icons, somewhere in the /usr/share/icons directories, allegedly. The command syntax is as follows
$ notify-send -i ${icon file, path and basename} "Docker Daemon" \ "docker daemon is running"
I plan to put this in my .profile; or somewhere else if that doesn’t work on a graphic login. This article on stackexchange addresses how to run a script on GNOME login.
I became interested in customising the look and feel and found “how-to-customise-the-appearance-of-notify-send” at stackexchange, although it seems this dependent on the notification daemon.
Elementary
I came across another use case and needed it to run on an elementary OS systems. The version of notification used by elementary seems to have some differences. I installed notify-osd
and then copied the icon I wanted to use to /usr/share/icons
. The icon is then referred to by its file name prefix.
Raspbian
Installing on Raspbian; installing notify-send on Raspbian. Stranger than expected. I got this reply, i.e. I am using the wrong daemon.
sudo apt -y install xfce4-notifyd && notify-send 'your notifications look like this'
However, while trying to make this do what I want on Raspian I was pointed at Zenity.
I added the comments on elementary and amended the comment on .profile.
I added the comments and tag on Raspbian
I moved these comments today.
To make this work on the original use case, I made myself a docker icon, .png 32×32 to decorate the message.
I found it on google, and replaced the white background with transparency. It’s not ideal, maybe I should find something better. Here’s a screen shot,
And here’s the command syntax,