The apm-scripts-0.1-3mdk package contains various scripts to be run on
suspend. One if them is /etc/sysconfig/apm-scripts/suspend.d/5XFree
which includes code to lock the X display on suspend.
Unfortunately, the author is under believe that if one user is running
KDE, they all are. So if there is a DCOP server running the script
tries only DCOP to lock any display. That scheme fails for the
obvious reason.
The best solution I have found is simply to try using DCOP before
using the other, more hacky, methods available. (Testing whether the
process specified in .DCOPserver_hostname_display is running, fails
because a DCOP server might be around after logout.) The following
rewritten script does the locking correct
#!/bin/sh
# -*- Mode: shell-script -*-
# $Id:$
[ -e /etc/sysconfig/apmd ] && . /etc/sysconfig/apmd
# Don't try to restore the terminal or lock X if X isn't running...
[ "x`pidof X`" != x ] && {
[ -n "$CHANGEVT" -a "$CHANGEVT" != "0" ] && chvt 1
[ "x$LOCK_X" = "xyes" -o "x$LOCK_X" = "x1" ] && {
# Lock X, based on patch from Hannu Martikka
# <[EMAIL PROTECTED]>
# PMN: changed to use who rather than w since that lists the display
who |awk '{print $1, $2}'|grep -v '-'|grep : | \
sort -u | \
while read line; do
Usern=`echo $line |awk '{print $1}'`
XDisp=`echo $line |awk '{print $2}'`
if [ "x$Usern" = "xroot" ]; then
xlock -display $XDisp &>/dev/null &
else
# PMN: First try to see if we can get a dcopserver (KDE) to respond;
# otherwise do something ugly
su $Usern -c "env DISPLAY=$XDisp dcop kdesktop KScreensaverIface
'lock()' || xscreensaver-command -display $XDisp -lock || (xscreensaver -display
$XDisp -no-splash &sleep 1; xscreensaver-command -display $XDisp -lock) || (xlock
-display $XDisp &)" &>/dev/null
fi
done
}
}
Best
Peter
--
http://www.linearity.org/turtle/contact.html
``When you have had all the experiences, met all the famous people,
made some money, toured the world and got all the acclaim you still
think--is that it? Some might be satisfied--but I wasn't'' -- G. Harrison
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com