Subject: [PATCH] Add support for knotify but only use it if aosd_cat is not installed because it is ugly

From: Raphael Geissert <[email-masked]>
Date: Thu, 29 Jan 2009 17:35:02 -0600

Signed-off-by: Raphael Geissert <[email-masked]>
---
 TODO                   |    2 --
 etc/acpi/lib/notify.sh |    8 +++++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/TODO b/TODO
index 1a45f94..52532bc 100644
--- a/TODO
+++ b/TODO
@@ -12,5 +12,3 @@
 
 * test bluetooth toggling when both the internal adapter and an external
   adapter are present.
-
-* add support for knotify as a notification service
diff --git a/etc/acpi/lib/notify.sh b/etc/acpi/lib/notify.sh
index 2df91f9..882bdd1 100755
--- a/etc/acpi/lib/notify.sh
+++ b/etc/acpi/lib/notify.sh
@@ -34,14 +34,20 @@ notify() {
 	fi
     fi
 
-    if [ -z "$OSD_SHOWN" ]; then
+    if [ -z "$OSD_SHOWN" ] && [ -x /usr/bin/aosd_cat ]; then
 	killall -q aosd_cat
 	if [ -n "$MSG" -a -z "$(echo $MSG | sed 's/.*[0-9]\+//g')" ]; then
 		echo "$MSG%" | aosd_cat -f 0 -u 100 -o 0 -n "$OSD_FONT" &
 	else
 		echo "$MSG" | 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
+    fi
+
     else
 	echo "$MSG" > /dev/console
     fi