Alert_applet - monitor session dbus messages from the system tray.
Aug 24, 2004 Stew Benedict <sbenedict@mandrakesoft.com>

Alert_applet sits in the system tray (XFCE, KDE, GNOME), and waits for messages on the user's dbus session.  It runs a service, alertservice, which picks up the dbus messages, echoing them on to the GUI.  The user can simply acknowledge the message, or initiate actions based on the nature of the message.

Overview:

The application consists of five key files:

/usr/bin/alert_applet   	- the GUI
/usr/bin/alert_sound   		- script to play alert sounds
/usr/bin/send_alert   		- wrapper to make using dbus-send a little easier
/usr/bin/alertservice    	- the session dbus service
/etc/profile.d/dbus-session.sh  - ensures DBUS_SESSION_BUS_ADDRESS shell 
				  variable is defined for shell sessions

Settings for the application are stored in ~/.alert_appletrc

If you have a personal .xinitrc, you would want to launch the alert_applet
there:

/usr/bin/alert_applet & 

To get the DBUS_SESSION_BUS_ADDRESS get the value from your environment, 
once in X:

echo $DBUS_SESSION_BUS_ADDRESS

Or:

.  /var/tmp/dbus-session$DISPLAY

(if $DISPLAY is defined, otherwise you need to work out which display you're 
trying to talk to)

With the included patches to hotplug, when a usb device that is not matched 
with a kernel driver is connected to the machine, a lookup is done in 
/usr/share/alert_applet/usbtable for a URL to download 3rd party drivers. 

To patch hotplug (as root):

cd /etc/hotplug
patch -p0 -b --suffix .alert < /usr/share/alert_applet/hotplug.patch

If you want to see more info in /var/log/messages on usb events, uncomment the 
following line in /etc/hotplug/usb.agent:

# DEBUG=yes export DEBUG

to revert the patches:

cd /etc/hotplug
mv usb.agent.alert usb.agent
rm dbus.functions

Some examples of communicating with alert_applet from shell scripts (first stanza gets the DBUS_SESSION_BUS_ADDRESS, which may be needed if the script is run
from cron).

if [ -f "/var/tmp/dbus-xsession:0.0" ] && [ -O "/var/tmp/dbus-xsession:0.0" ]; then
        . "/var/tmp/dbus-xsession:0.0"
fi

dbus-send --print-reply --type=method_call --dest=com.mandriva.Message.EchoService /com/mandriva/Message com.mandriva.Message.Echo string:'NewDevice: http://www.foobar.org'

dbus-send --print-reply --type=method_call --dest=com.mandriva.Message.EchoService /com/mandriva/Message com.mandriva.Message.Echo string:'foobar test message'

The above can be simplied now with: 

	send_alert foobar test message

If you have new URLs to add to usbtable, or have interesting ideas of ways to 
use/modify this application, please forward them to sbenedict@mandrakesoft.com.


