Want to set a custom idle time for your Linux to automatically go to sleep? Here’s how to do this in Ubuntu, Fedora, Debian, Manjaro and other Linux running Gnome Desktop.
The system settings (gnome-control-center) offers options to toggle on/off automatic suspend and inactive time delay. However, the minimum value is 15 minutes. What if you want to set it to either less than 15 min, or a custom value not in the list?
Single command to change Auto-Suspend idle time.
Firstly, either click top-left ‘Activities’ or press the Super (Windows) key to bring up search box. Then search and open terminal.
Secondly, choose the command to run in terminal:
- Change the automatic suspend timeout, when on AC power supply (5 minutes (300s) for instance):
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 300
The command just change the timeout value. To toggle on or off the ‘Automatic Suspend‘ function, change the value of ‘sleep-inactive-ac-type’ to suspend or nothing.
- Set custom automatic suspend timeout, when on battery (2 min (120s) for instance):
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 120
You can also change the value of ‘sleep-inactive-battery’ type to enable or disable auto-suspend.
Change the Idle Time via Dconf Editor.
For those hate Linux commands, the job can be done via a graphical tool called Dconf Editor. Search for and install it from system “Software” app, then do:
Open Dconf Editor and navigate to org/gnome/settings-daemon/plugins/power. There scroll down and change the values of:
- “sleep-inactive-ac-timeout”
- “sleep-inactive-battery-timeout”
Also toggle on / off the functions by changing values of:
- “sleep-inactive-ac-type”
- “sleep-inactive-battery-type”
Finally start or re-start the “System Settings” and go to Power in left pane. You’ll see the new timeout take effects in ‘Automatic Suspend’ dialog:
NOTE: Though the custom values display in System Settings, they are not permanent! It WILL disappear once you select another time and restart it.