Generic tray icon for Gnome.
gtrayicon defines two actions: activate and deactivate, that are alternated by clicking in the tray icon.

You choose what commands to run on each action.

Also you can define each action's icon. Check included help with "--help" parameter.

Tip: you can specify the same action and icon for both triggers and it will work like a normal launcher icon.

Tip: a sample menu file is included with the package. Check /usr/share/gtrayicon/ for more info.

Example: gtrayicon --activate="play start.wav" --deactivate="play stop.wav"

source codeubuntu package