See attached.
Cheers,
--
Cristian
diff --git a/etc/acpi/lib/notify.sh b/etc/acpi/lib/notify.sh
index b476b53..4a4aeaf 100644
--- a/etc/acpi/lib/notify.sh
+++ b/etc/acpi/lib/notify.sh
@@ -3,66 +3,69 @@
# this file is to be sourced
notify() {
- CATEGORY=$1
- MSG=$2
- if [ -n "$4" -o \( -n "$3" -a "$3" != 'fast' \) ]; then
- echo "usage: notify 'category' 'message text' [fast]" > /dev/stderr
+ # $1 - category
+ # $2 - message
+ # $3 - ???
+ # $4.. - ???
+ # positional parameters never change during the course of this function
+
+ if [ "$4" -o \( "$3" -a "$3" != fast \) ]; then
+ echo "usage: notify 'category' 'message text' [fast]" >&2
return 1
fi
- echo "$MSG" # for /var/log/acpid
+ echo "$2" # for /var/log/acpid
if [ ! -S /tmp/.X11-unix/X0 ]; then
- echo "$MSG" > /dev/console
+ echo "$2" > /dev/console
return
fi
- if [ "x$ENABLE_OSD" = "xno" ]; then
- return
- fi
+ [ "$ENABLE_OSD" != no ] || return
detect_x_display
+ # $user is a global variable set by function 'detect_x_display'
- OSD_SHOWN=
+ local GOSDC=/usr/bin/gnome-osd-client OSD_SHOWN=
# try to show a nice OSD notification via GNOME OSD service
- GOSDC=/usr/bin/gnome-osd-client
- if [ -z "$OSD_SHOWN" ] && [ -x "$GOSDC" ]; then
+ if [ -x "$GOSDC" ]; then
if ps -u $user -o cmd= | grep -q '^/usr/bin/python /usr/bin/gnome-osd-event-bridge'; then
- if echo "$MSG" | grep -q '[0-9]'; then
- animations='off'
+ local animations timeout
+
+ if echo "$2" | grep -q '[0-9]'; then
+ animations=off
else
- animations='on'
+ animations=on
fi
- if [ "$3" = 'fast' ]; then
+ if [ "$3" = fast ]; then
timeout=150
else
timeout=1200
fi
- echo "<message id='eee-$CATEGORY' osd_fake_translucent_bg='off' osd_vposition='bottom' animations='$animations' hide_timeout='$timeout' osd_halignment='center'>$MSG</message>" \
- | su "$user" -c "$GOSDC -s --dbus"
+ echo "<message id='eee-$1' osd_fake_translucent_bg='off' osd_vposition='bottom' animations='$animations' hide_timeout='$timeout' osd_halignment='center'>$2</message>" |
+ su "$user" -c "$GOSDC -s --dbus"
OSD_SHOWN=1
fi
fi
if [ -z "$OSD_SHOWN" ] && [ -x /usr/bin/aosd_cat ]; then
killall -q aosd_cat
- if [ "$3" = 'fast' ]; then
- echo "$MSG" | aosd_cat -n "$OSD_FONT" -f 0 -u 150 -o 0 &
+ # $OSD_FONT ia a global variable set in /etc/default/eeepc-acpi-scripts
+ if [ "$3" = fast ]; then
+ echo "$2" | aosd_cat -n "$OSD_FONT" -f 0 -u 150 -o 0 &
else
- echo "$MSG" | aosd_cat -n "$OSD_FONT" -f 100 -u 1000 -o 100 &
+ echo "$2" | aosd_cat -n "$OSD_FONT" -f 100 -u 1000 -o 100 &
fi
OSD_SHOWN=1
fi
if [ -z "$OSD_SHOWN" ] && [ -x /usr/bin/dcop ]; then
- dcop --user "$user" knotify Notify notify "notification" "knotify" "$MSG" "" "" 16 2
+ dcop --user "$user" knotify Notify notify notification knotify "$2" "" "" 16 2
OSD_SHOWN=1
fi
if [ -z "$OSD_SHOWN" ] && [ -x /usr/bin/kdialog ]; then
- su "$user" -c "kdialog --passivepopup '$MSG' 2 --title 'Eee PC'" &
+ su "$user" -c "kdialog --passivepopup '$2' 2 --title 'Eee PC'" &
OSD_SHOWN=1
fi
-
}
-
_______________________________________________
Debian-eeepc-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-eeepc-devel