On 18 November 2010 12:54, Michael Meskes <mes...@debian.org> wrote: > Could it be that this patch breaks other display managers? > > feivel:~# for pid in `ps -U <user that's actually logged in> -o pid=`; do > grep -z XAUTHORITY /proc/$pid/environ; done > feivel:~# > > It seems my system using kdm does not have any XAUTHORITY setting in the > environment.
What about this version then? Cheers, Luca
--- a/lib/power-funcs 2010-11-18 14:16:14.471511734 +0100 +++ b/lib/power-funcs 2010-11-18 14:24:17.347511734 +0100 @@ -18,8 +18,16 @@ fi fi if [ x"$user" != x"" ]; then - userhome=`getent passwd $user | cut -d: -f6` - export XAUTHORITY=$userhome/.Xauthority + for pid in `ps -U $user -o pid=`; do + if grep -z -q XAUTHORITY /proc/$pid/environ; then + export `grep -z XAUTHORITY /proc/$pid/environ` + break + fi + done + if [ -z $XAUTHORITY ]; then + eval userhome=~$user + export XAUTHORITY=$userhome/.Xauthority + fi else export XAUTHORITY="" fi @@ -29,7 +37,7 @@ # getXconsole gets the foreground (console) X user getXconsole() { console=`fgconsole`; - displaynum=`ps t tty$console | sed -n -re 's,.*/X .*:([0-9]+).*,\1,p'` + displaynum=`ps t tty$console | sed -n -re 's,.*/X(org)? .*:([0-9]+).*,\2,p'` if [ x"$displaynum" != x"" ]; then export DISPLAY=":$displaynum" getXuser