If you want to lock your screen after some time, you can use xautolock
exec --no-startup-id xautolock -time 4 -locker "i3lock-wrapper -l"
And I create a mode to handle lock, suspend, hibernate, reboot and poweroff
set $Locker i3lock-wrapper -l && sleep 1
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id $Locker, mode "default"
bindsym e exec --no-startup-id i3-msg exit, mode "default"
bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default"
bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default"
bindsym r exec --no-startup-id systemctl reboot, mode "default"
bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Delete mode "$mode_system"
If you mean lock and suspend when closing laptop lid, you can check this repo and this post