On Wed, Jan 11, 2012 at 01:05:06PM +0100, Matthijs Kooijman wrote: > It seems something like this could happen through DBus, but > gnome-settings-daemon is only active on the session bus and I doubt it's > possible to implement this reliably (since you don't know where the dbus > session for the user lives?).
Could you please try patching /usr/share/acpi-support/policy-funcs with the attached patch and tell me if it fixes the problem for you? I haven't thoroughly tested that patch yet, though, but it seems to work for me. Michael -- Michael Meskes Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org) Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org Jabber: michael.meskes at googlemail dot com VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
--- /usr/share/acpi-support/policy-funcs 2011-12-13 15:00:19.000000000 +0100 +++ policy-funcs 2012-01-11 16:49:10.711114956 +0100 @@ -21,7 +21,8 @@ pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon; } || - PowerDevilRunning + PowerDevilRunning || + GSDWithSuspend } PowerDevilRunning() { @@ -36,4 +37,18 @@ done return 1 +} + +GSDWithSuspend() { + test -x /usr/bin/dbus-send || return 1 + + local DBUS_SESS + for p in $(pidof gnome-settings-daemon); do + test -r /proc/$p/environ || continue + DBUS_SESS=$(grep -a -z "DBUS_SESSION_BUS_ADDRESS=" /proc/$p/environ || :) + test "$DBUS_SESS" != "" || continue + ! su $(ps -o user= $p) -s /bin/sh -c "$DBUS_SESS dbus-send --system --print-reply --dest="org.freedesktop.UPower" --type=method_call --reply-timeout=6000 /org/freedesktop/UPower org.freedesktop.DBus.Properties.Get string:org.freedesktop.UPower string:CanSuspend" | grep -q true || return 0 + done + + return 1 }