Here's what I did:
I created a file /etc/acpi/events/lm_lid and wrote into it:
event=button/lid.* action=/etc/acpi/lid.sh I created a file /etc/acpi/lid.sh and wrote into it:
#!/bin/sh gnome-screensaver-command --lock The good news are that this script is being executed when I close the lid. The bad news are that it doesn't lock the system. Any other command I put in the script is executed when I close the lid except the lock itself. When I run the script manually from command line the system locks.
What did I miss?