acpi-support: Lock screen with dbus during resume

Dennis Jansen Dennis.Jansen at web.de
Wed Jul 9 11:54:19 BST 2008


Hi,

what do you think about using dbus to fix the screensaver locking in recent
versions of GNOME and KDE.
A slightly adapted version of /etc/acpi/resume.d/90-xscreensaver.sh.

#!/bin/sh

# lock the screen via dbus
if pidof dbus-daemon > /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 "dbus-send --session --dest=org.freedesktop.ScreenSaver \
  --type=method_call --print-reply /ScreenSaver \
  org.freedesktop.ScreenSaver.Lock"
  fi
  done
fi

Of course locking might be replaced with e.g. SimulateUserActivity. If you
would like any changes for integration let me know.

Cheers,

Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20080709/198d1069/attachment.htm 


More information about the Ubuntu-devel-discuss mailing list