I've just been looking into doing this. I usually run a script manually but to have the script run when the lid is closed you need to edit /etc/acpi/acpi_handler.sh:
Code:
#!/bin/sh
# Default acpi script that takes an entry for all actions
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
lid) su dive -c /home/dive/scripts/suspendlock
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esac
The lid line points to my script which contains the suspend commands and xscreensaver command (rather than kscreensaver). You need the su -c or xscreensaver will complain and go into an endless loop saying it can't open display.
Of course you will also need to turn off the thinkpad lid option in kde control centre to use the acpi handler or there will be conflicts I should imagine.
Hope it's useful for you.