The previous answer helped me write this fragment of bash script that handles Lock and Unlock session events for the current session. I use it to suspend browser processes when the session is locked and to resume them when it unlocks. Tested under Debian unstable (Xfce 4.12) Enjoy!
session=/org/freedesktop/login1/session/$XDG_SESSION_ID
iface=org.freedesktop.login1.Session
dbus-monitor --system "type=signal,path=$session,interface=$iface" 2>/dev/null |
while read signal stamp sender arrow dest rest; do
case "$rest" in
*Lock)
echo LOCKED at $stamp
pause $@
;;
*Unlock)
echo UNLOCKED at $stamp
resume $@
;; #unknown Session signal received
*)
# echo $signal $stamp $sender $arrow $dest $rest
esac
done