I use the default handler.sh file for my stuff, found in /etc/acpi. I have the lid closure trigger a suspend-to-ram:
button/lid) #echo "LID switched!">/dev/tty5 grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ]; then echo -n mem >/sys/power/state fi ;;
You can easily replace "echo -n mem >/sys/power/state" with any of the following, depending on your desired result:
xset dpms force off xscreensaver-command -lock etc.
xset needs to connect to the X server, so it needs both for the DISPLAY to be specified and also to have access to the XAuthority cookie for the X server. Otherwise it will not work - can't connect to the X server. Since acpid runs as a sytem service it ussually doesn't have access to that information. -- damjan