How do I prevent GNOME suspending while I finish a compilation job

7,827

Solution 1

I haven't got the time for all details now, but see the GNOME Power Manager's FAQ "How do I make my application stop the computer auto-suspending" which points to the Inhibit() and UnInhibit() DBus-calls.

A caveat: if the process calling Inhibit() exits, the inhibition is ended - dbus-send in a Shell script thus won't do, but some wrapper script (e.g. in Python) is needed.

(Edit This blog post contains a little more information, also a Python stub that could be useful.)

Solution 2

You can disable inactivity timeout completely.

For example to disable the suspend timeout only for AC power, run

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0

I personally thinks its completely stupid having an inactivity timeout to suspend the computer, while its on AC power, by default and with no option for normal people to disable this.

Share:
7,827

Related videos on Youtube

davefiddes
Author by

davefiddes

Updated on September 18, 2022

Comments

  • davefiddes
    davefiddes almost 2 years

    I am trying to build a custom kernel for my machine which is taking a long time to build (as expected). Is it possible to stop my GNOME desktop from suspending the machine until the compilation has completed and then have it suspend (assuming I'm away from the machine for the 30 minutes it would normally take).

    I don't want to permanently disable suspend (which is easy to do via the system settings control panel but wastes power) but rather be able to specify (via PID?) my compile job and have the computer suspend when it finishes.

  • user48678
    user48678 about 12 years
    Oh, well, using the link provided by sr_, you can write the enable/disable_autosuspend wrappers... Edit oh no, the process calling inhibit() must not exit...
  • davefiddes
    davefiddes about 12 years
    Looks like I'm going to need to write a bit of python to do the necessary inhibiting and watching of the build process. Hmm. Thanks for digging up the details.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix about 4 years
    Downvoting because: "This is probably doable via gconftool-2. A little research and hacking with gconf-editor should help (I can't really help regarding that, I don't use gnome)."
  • Rafael Kitover
    Rafael Kitover over 3 years
    To also disable auto-suspend on battery power, this works: gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
  • curiouser
    curiouser about 3 years
    While this answer will disable auto suspend for AC power, it also changes the timeout to 0. To preserve the timeout setting and simply disable the auto suspend, use gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing' source