In my former emails I explained some problems I had with notifications
about battery level warnings that first of all were displayed twice
(once through a running kpowersave and again through
zenity|kdialog|xmessage) and secondly the displayed message was a
"Powersaved even:" string without the expected BATTERY WARNING.
So I thought I might investigate this a little bit further and tried
different setups.

Ideally on a battery warning event as a first step
notify battery.warning scheme_powersave empty XX
is called.
If kpowersave is not connected
do_x_notification Powersaved event: BATTERY WARNING
is called as a second step.

These are my results:

OpenSUSE 1.0:
KDE : kpowersave connected : kpowersave only warning (do_x_notification
is not called)
KDE : kpowersave not con. : do_x_notification Powersaved event: BATTERY
WARNING called, displayed with kdialog
GNOME : kpowersave connected : kpowersave only warning
(do_x_notification is not called)
GNOME : kpowersave not con. : do_x_notification Powersaved event:
BATTERY WARNING called, displayed with zenity

I would say, everything as expected.

Gentoo unstable (hal-0.5.5.1, dbus-0.5)
KDE : kpowersave connected : kpowersave only warning (do_x_notification
is not called)
KDE : kpowersave not con. : do_x_notification Powersaved event: BATTERY
WARNING called, *nothing* is displayed
GNOME : kpowersave connected : kpowersave only warning
(do_x_notification is not called)
GNOME : kpowersave not con. : do_x_notification Powersaved event:
BATTERY WARNING called, *nothing* is displayed

Looking into this I found, that Gentoo installs Xorg to /usr/bin (the
soon to be released modular Xorg will do that too), so no users is
found. Secondly w doesn't have the -n flag on non SUSE platforms and
third su has to be called in a different way. The attached patch fixes
all three issues (works for SUSE too). Feel free to use it!
After that, I got the same behaviour as with OpenSUSE 10.
One issue remained: If I restart powersaved while kpowersave stays
running, powersaved seems to receive no connect event from kpowersave.
So on subsequent battery warning events the warning message is displayed
twice (kpowersave + powersave notification).

Now comes the fun part:
Debian unstable (hal-0.5.5.1, dbus-0.5) (holds also for Ubuntu Breezy)
KDE : kpowersave connected : kpowersave warning and do_x_notification is
called with "Powersaved event:", kdialog displays "Powersaved event:"
KDE : kpowersave not con. : "do_x_notification Powersaved event:"
called, displayed with kdialog
GNOME : kpowersave connected : kpowersave warning and do_x_notification
is called with "Powersaved event:", zenity displays "Powersaved event:"
GNOME : kpowersave not con. : "do_x_notification Powersaved event:"
called, displayed with zenity

Any ideas why this empty "Powersaved event:" message is generated under
Debian and regardless of a running kpowersave the powersave notification
mechanism (zenity/kdialog/xmessage) is used?
If you need more information please let me know.

Cheers,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

diff -ur powersave.orig/scripts/wm_logout powersave/scripts/wm_logout
--- powersave.orig/scripts/wm_logout	2005-12-16 13:28:07.000000000 +0100
+++ powersave/scripts/wm_logout	2005-12-16 13:46:31.000000000 +0100
@@ -21,13 +21,15 @@
 #                                                                         #
 ###########################################################################
 
+sleep 5
+
 # first get helper functions (e.g. DEBUG, load_scheme, ...)
 . "${0%/*}/helper_functions"
 . "${PUB_SCRIPT_DIR}/x_helper_functions"
 
 get_x_user
 DEBUG "Logging out of kde for user: $X_USER" INFO
-[ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 0 0"
+[ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 0 0"
 if [ $? != "0" ]; then
     DEBUG "Could not log out user '$X_USER' out of KDE display '$DISP'." DIAG
     $SCRIPT_RETURN $EV_ID 1 "Could not log out user $X_USER out of KDE display $DISP"
diff -ur powersave.orig/scripts/wm_shutdown powersave/scripts/wm_shutdown
--- powersave.orig/scripts/wm_shutdown	2005-12-16 13:28:07.000000000 +0100
+++ powersave/scripts/wm_shutdown	2005-12-16 13:49:10.000000000 +0100
@@ -43,7 +43,7 @@
 
     get_x_user
     DEBUG "Shutting down kde for user: $X_USER" INFO
-    [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 2 2"
+    [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 2 2"
     if [ $? != "0" ]; then
         DEBUG "Could not shut down KDE for user '$X_USER'." DIAG
         return 1;
Nur in powersave.orig/scripts: wm_shutdown.orig.
diff -ur powersave.orig/scripts/x_helper_functions powersave/scripts/x_helper_functions
--- powersave.orig/scripts/x_helper_functions	2005-12-16 13:28:07.000000000 +0100
+++ powersave/scripts/x_helper_functions	2005-12-16 13:15:16.000000000 +0100
@@ -103,7 +103,7 @@
     esac
     get_x_user
     if check_x_access; then
-        su $X_USER -s /bin/bash -c "DISPLAY=$DISP $XMESSAGE_BIN -center -fn \
+        su - $X_USER -c "DISPLAY=$DISP $XMESSAGE_BIN -center -fn \
             '-misc-fixed-bold-r-*-*-18-*-*-*-*-*-iso10646-1' $ARG\
             '`echo $MESSAGE|fmt -w 60 `' $WAIT"  # we re-format it to 60 chars
         RET=$?
@@ -132,7 +132,7 @@
     esac
     get_x_user
     [ "$X_USER" -a -n "$DISP" ] && \
-        su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDIALOG_BIN $ARG \"$MSG\" $WAIT" 
+        su - $X_USER -c "DISPLAY=$DISP $KDIALOG_BIN $ARG \"$MSG\" $WAIT" 
     return $?
 }
 
@@ -154,7 +154,7 @@
     esac
     get_x_user
     if check_x_access; then
-        su $X_USER -s /bin/bash -c "DISPLAY=$DISP $ZENITY_BIN $ARG --text=\"$MSG\" $WAIT" 
+        su - $X_USER -c "DISPLAY=$DISP $ZENITY_BIN $ARG --text=\"$MSG\" $WAIT" 
         return $?
     else
 	return 255
diff -ur powersave.orig/wttyhx powersave/wttyhx
--- powersave.orig/wttyhx	2005-12-16 13:28:07.000000000 +0100
+++ powersave/wttyhx	2005-12-16 13:13:57.000000000 +0100
@@ -95,6 +95,7 @@
 	case "$BIN" in
 		/usr/X11R6/bin/XFree86) VERSION[$n]=4 ;;
 		/usr/X11R6/bin/Xorg)    VERSION[$n]=4 ;;
+		/usr/bin/Xorg)		VERSION[$n]=4 ;;
 		/usr/X11R6/bin/X)       VERSION[$n]=3 ;;
 		*)                      continue      ;;
 	esac
@@ -119,7 +120,7 @@
 	# id at several places and then take the user with the highest uid.
 	while read USER D R; do
 		test "$D" = "$DISP" && break
-	done < <(w -hn | sed -n 's#^\([^ ]*\).* :\([0-9]\+\).*$#\1 \2#p')
+	done < <(w -h | sed -n 's#^\([^ ]*\).* :\([0-9]\+\).*$#\1 \2#p')
 	USER_W[$n]=$USER; UID_W[$n]=`id -u $USER 2>/dev/null`
 	while read TAG U0 U1 U2 U3 R; do
 		if [ "$TAG" = "Uid:" ] ; then

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
powersave-devel mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/powersave-devel

Reply via email to