Graphical notification from scripts

Environment: Linux

My laptop is getting long in the tooth and some programs load very slowly. Since some of these programs are exposed on the desktop as shortcuts to scripts, you need to double click on them to launch them. Unfortunatly, because they load slow and there is no feedback, I can never tell if my double click was recognized. After looking around a bit, I found a tool, notify-send, that allows you to inject messages into the desktop’s notification system.

First, install the package

I wanted to modify the launch script for Android Studio, which is the studio.sh file in Android Studio’s bin directory. I added the following at the top of the script:


This puts up a notification message for 6000ms with the idea.png icon with a summary of Starting and the body of Android Studio in bold below it. The notification pops up immediately, giving sufficient feedback so that I don’t keep mashing the mouse button to launch it.

Note that the body allows some simple HTML to be used and the icon argument can either contain the location of an image file or the name of a system standard icon such as these listed here http://askubuntu.com/questions/189231/where-are-the-stock-icon-names-defined-for-the-unity-panel-service-indicators-an

No Comment.

Add Your Comment