--print-reply /ScreenSaver org.freedesktop.ScreenSaver.Lock
This will work with KDE4 and should as well work with newer Gnome versions. Tested with KDE 4.1 beta1. It needs the display variable to be set and be run as the appropriate user.
e.g. su $user -c "DISPLAY=:0 dbus-send... "
In Ubuntu 8.04 you can change your /etc/acpi/resume.d/90-xscreensaver.sh to lock the screen on resume like this:
#!/bin/sh
# now, we should poke xscreensaver so you get a dialog
#if pidof xscreensaver > /dev/null; then
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
su $user -c "(xscreensaver-command -deactivate)"
su $user -c "dbus-send --session --dest=org.freedesktop.ScreenSaver \
--type=method_call --print-reply /ScreenSaver \
org.freedesktop.ScreenSaver.Lock"
fi
done
#fi
{ 0 komentar... read them below or add one }
Post a Comment
Come on share your comment, but please do not spam