I have had a problem with using i3 as a window manager getting screen locking and suspend to work but this is how I got it fixed.
I had pm-suspend working from the terminal with sudo and i3lock installed.
The alias pm-suspend | i3lock
Had the advantage of also locking the screen however it needed to be run with a sudo command and password.
With an edit through visudo
%users ALL = NOPASSWD: /usr/sbin/pm-suspend
it could be made so that you don’t need to type the password as the user, so the alias can become,
sudo pm-suspend | i3lock
This got me thinking that it would be cool to be able to do this from a key press in i3 rather than a terminal.
The first part of doing this is to add the key short cut to .i3/config
bindsym $mod+p exec suspendandlock
then write a bash script into /usr/bin saved as suspendandlock
# suspend and lock
sudo pm-suspend | i3lock -c 000000
Finally we have to modify the sudoers file again with visudo and change the %users to %wheel.
%wheel ALL = NOPASSWD: /usr/sbin/pm-suspend
On Fedora 17 an additional edit is required with visudo, requiretty requires commenting out with visudo to be,
# Defaults requiretty
sECuRE from the i3 IRC chat helped out with the Fedora fix diagnosed through the log error.
requirement “uid >= 1000″ not met by user
Now if everything is work mod+p will trigger power suspend and when you awake will ask for a password.