I have set it to "suspend when inactive" after 30 minutes.
How does it determine whether it is inactive? Is it just user input via keyboard/mouse?
If I leave a program working away - say processing a video, which takes a long time, will it suspend after 30 minutes and stop that program? Same question for long downloads, will it suspend halfway through.
Good question. Let's find out!
Beginning by investigating the "Suspend when inactive for" option,
we can learn that it sets a GSettings key called
sleep-inactive-ac-timeout
:The documentation for this key provides a brief description:
but still doesn't explain what "inactive" means.
Searching for
sleep-inactive-ac-timeout
leads us to GNOME Settings Daemon,which periodically checks a property of GNOME Session called
Presence.status
:If it finds that the status is idle, it puts the system to sleep:
So we need to learn how GNOME Session decides whether the system is "idle."
Following backwards from where GNOME Session updates the value of
Presence.status
,we can see that it uses the
IDLETIME
counter from Xorg:The
IDLETIME
counter's behavior is summarized in a blog post by the author of GNOME Power Manager:This tells us that Ubuntu determines inactivity by measuring the amount of time that has passed since the last keystroke or mouse motion. CPU usage and network activity do not factor in.