#!/bin/sh # Lock the screen and then suspend. # Do a sudo now in order to not be prompted for # a sudo password after having locked the screen. sudo /bin/true \ && \ gnome-screensaver-command -l \ && \ sleep 3 \ && \ sudo pm-suspend # If 'gnome-screensaver-command -l' were ever to stop working (which # apparently has happened in the past), an alternative would be: # # dbus-send --type=method_call \ # --dest=org.gnome.ScreenSaver \ # /org/gnome/ScreenSaver \ # org.gnome.ScreenSaver.Lock \