Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Have a search for wake up calls. – Rinzwind Jul 31 '12 at 8:55
In Askubuntu? I just tried it and all the answers seem to pertain to waking the system from suspend or similar. – Jazz Jul 31 '12 at 22:04
up vote 12 down vote accepted

Good question. Let's find out!

  1. Beginning by investigating the "Suspend when inactive for" option,

    <property ...>Suspend when inactive for</property> ...
    <object ... id="combobox_sleep_ac">

    we can learn that it sets a GSettings key called sleep-inactive-ac-timeout:

    widget = GTK_WIDGET (gtk_builder_get_object (..., "combobox_sleep_ac")); ...
    g_object_set_data (G_OBJECT(widget), "_gsettings_key", "sleep-inactive-ac-timeout");

    The documentation for this key provides a brief description:

    The amount of time in seconds the computer on AC power needs to be inactive before it goes to sleep. A value of 0 means never.

    but still doesn't explain what "inactive" means.

  2. Searching for sleep-inactive-ac-timeout leads us to GNOME Settings Daemon,

    timeout_sleep = g_settings_get_int (..., "sleep-inactive-ac-timeout");

    which periodically checks a property of GNOME Session called Presence.status:

    result = g_dbus_proxy_get_cached_property (...->session_presence_proxy, "status");

    If it finds that the status is idle, it puts the system to sleep:

    idle_set_mode (..., GSD_POWER_IDLE_MODE_SLEEP);

    So we need to learn how GNOME Session decides whether the system is "idle."

  3. Following backwards from where GNOME Session updates the value of Presence.status,

    gsm_presence_set_status (presence, GSM_PRESENCE_STATUS_IDLE, ...);

    we can see that it uses the IDLETIME counter from Xorg:

    if (... && strcmp (counters[i].name, "IDLETIME") == 0) {
        ...->counter = counters[i].counter;
  4. The IDLETIME counter's behavior is summarized in a blog post by the author of GNOME Power Manager:

    gnome-power-manager uses a counter inside Xorg called IDLETIME. This counter is incremented only when the user does not move the mouse, or click some keys. When the user clicks something, the IDLECOUNTER is reset.

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.

share|improve this answer
as you said in last line why The CPU usage not considerable ? My doubt is i came from… . because if i put download of 1GB file then it can take a lot of time . even I am afk My PC still doing download of that file right . That means my PC active right ? :D – Raja Nov 22 '12 at 13:12
+1 for excellent investigation and breakdown. And @AgentCool, no. Activity is determined by keyboard or mouse press. Your download isn't going to press any keys and keep the PC awake. – Oxwivi Sep 12 '14 at 19:19
@Oxwivi thats comment almost a year ago . not after the edit. :) – Raja Sep 13 '14 at 4:45
@AgentCool My bad, I didn't notice. The post was recently bumped, likely due to yesterday's edit. Was a question I was interested in, so checked it. – Oxwivi Sep 14 '14 at 6:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.