[Debian-eeepc-devel] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 45d1d2f03d6406576a0d767f341689b499c921b1

Damyan Ivanov dmn at debian.org
Tue Sep 9 07:46:20 UTC 2008


The following commit has been merged in the master branch:
commit ea44294d7d8c2dbb49a2951157e0dc1f363b42cf
Author: Damyan Ivanov <dmn at debian.org>
Date:   Tue Sep 9 08:36:52 2008 +0300

    move notify() to lib/notify.sh
    
    notify.sh now can be sourced by other scripts that need user
    notification

diff --git a/actions/hotkey.sh b/actions/hotkey.sh
index fcba767..a9fd9cd 100755
--- a/actions/hotkey.sh
+++ b/actions/hotkey.sh
@@ -5,53 +5,9 @@
 
 . /etc/default/eeepc-acpi-scripts
 . /usr/share/eeepc-acpi-scripts/functions.sh
+. /etc/acpi/lib/notify.sh
 code=$3
 
-notify() {
-    CATEGORY=$1
-    MSG=$2
-    if [ -n "$3" ]; then
-	echo "usage: notify 'catgory' 'message text'" > /dev/stderr
-	return 1
-    fi
-    echo "$MSG"  # for /var/log/acpid
-    if [ -S /tmp/.X11-unix/X0 ]; then
-        detect_x_display
-
-    if [ "x$ENABLE_OSD" = "xno" ]; then
-        return
-    fi
-
-    OSD_SHOWN=
-
-    # try to show a nice OSD notification via GNOME OSD service
-    GOSDC=/usr/bin/gnome-osd-client
-    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'
-	    else
-		animations='on'
-	    fi
-	    echo "<message id='eee-$CATEGORY' osd_fake_translucent_bg='off' osd_vposition='bottom' animations='$animations' hide_timeout='1200' osd_halignment='center'>$MSG</message>" \
-		| sudo -u $user $GOSDC -s --dbus
-	    OSD_SHOWN=1
-	fi
-    fi
-
-    if [ -z "$OSD_SHOWN" ]; 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
-    fi
-    else
-	echo "$MSG" > /dev/console
-    fi
-}
-
 show_wireless() {
     detect_wlan
     if grep -q $WLAN_IF /proc/net/wireless; then
diff --git a/lib/notify.sh b/lib/notify.sh
new file mode 100755
index 0000000..0156129
--- /dev/null
+++ b/lib/notify.sh
@@ -0,0 +1,49 @@
+# eeepc-acpi-scripts notification library
+#
+# this file is to be sourced
+
+notify() {
+    CATEGORY=$1
+    MSG=$2
+    if [ -n "$3" ]; then
+	echo "usage: notify 'catgory' 'message text'" > /dev/stderr
+	return 1
+    fi
+    echo "$MSG"  # for /var/log/acpid
+    if [ -S /tmp/.X11-unix/X0 ]; then
+        detect_x_display
+
+    if [ "x$ENABLE_OSD" = "xno" ]; then
+        return
+    fi
+
+    OSD_SHOWN=
+
+    # try to show a nice OSD notification via GNOME OSD service
+    GOSDC=/usr/bin/gnome-osd-client
+    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'
+	    else
+		animations='on'
+	    fi
+	    echo "<message id='eee-$CATEGORY' osd_fake_translucent_bg='off' osd_vposition='bottom' animations='$animations' hide_timeout='1200' osd_halignment='center'>$MSG</message>" \
+		| sudo -u $user $GOSDC -s --dbus
+	    OSD_SHOWN=1
+	fi
+    fi
+
+    if [ -z "$OSD_SHOWN" ]; 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
+    fi
+    else
+	echo "$MSG" > /dev/console
+    fi
+}
+

-- 
Maintenance of eeepc-acpi-scripts debian package



More information about the Debian-eeepc-devel mailing list