Set up automatic suspend
You can configure your computer to automatically suspend when idle. Different intervals can be specified for running on battery or plugged in.
Open the Activities overview and start typing Power.
Click Power to open the panel.
In the Power Saving Options section, click Automatic Suspend.
Choose On Battery Power or Plugged In, set the switch to on, and select a Delay. Both options can be configured.
On a desktop computer, there is one option labeled When Idle.