acpi-support (0.137-5) policy-funcs.diff

Summary

 lib/policy-funcs |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

    
download this patch

Patch contents

--- acpi-support-0.137.orig/lib/policy-funcs	2010-06-24 09:16:57.000000000 +0200
+++ acpi-support-0.137.orig/lib/policy-funcs	2010-06-24 09:18:04.000000000 +0200
@@ -1,3 +1,5 @@
+. /usr/share/acpi-support/power-funcs
+
 CheckUPowerPolicy() {
 	if pidof upowerd > /dev/null; then
 		return 0;
@@ -5,12 +7,21 @@
 		return 1;
 	fi
 }
+
+# The (not very aptly named) function CheckPolicy checks if the current X
+# console user is running a power management daemon that handles suspend/resume
+# requests. This is used in various places to determine if we need to handle
+# something ourselves or if we need to pass the info on to a power management
+# daemon (e.g. through a fake key press).
+
 CheckPolicy() {
 	local PMS
+
+	getXconsole
 	PMS="gnome-power-manager kpowersave xfce4-power-manager"
 	PMS="$PMS guidance-power-manager.py dalston-power-applet"
 	if pidof -x $PMS > /dev/null ||
-	   (pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop kded kded loadedModules | grep -q klaptopdaemon) ||
+	   (test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon) ||
 	   PowerDevilRunning ; then
 		echo 0;
 	else