5

Is there any way to make Ubuntu 12.04 understand when it should suspend or not in terms of the software that is currently running?

For example, if I am installing something and it takes more than 10 minutes, which is the time limit for my PC to suspend, then I do not want my system to system to suspend till the installation of the program is finished. If my system is inactive I want it to suspend,but on the other hand if something is running I do not want to suspend.

3
  • Do you want to know how could you turn off the suspension option or only when a program is open?
    – Lucio
    Aug 30, 2012 at 23:32
  • I want to prevent my system to suspend when a program is doing something.For example if I am installing something and it takes more than 10 minutes,which is the time limit for my pc to suspend,then I do not want my system to system to suspend till the installation of the program is finished.If my system is inactive I want it to suspend,but on the other hand if something is running I do not want to suspend. Aug 31, 2012 at 9:12
  • 1
    Sorry, I don't know how to do that. My advice is disable the suspention when will run a application until someone tells you how.
    – Lucio
    Sep 1, 2012 at 2:25

3 Answers 3

4

A relatively simple way to do it is by installing a program called caffeine. You'll need to add the repository then install it. For example, via the terminal.

sudo add-apt-repository ppa:caffeine-developers/ppa && sudo apt-get update && sudo apt-get install caffeine && sudo apt-get install gir1.2-appindicator3-0.1 gir1.2-notify-0.7

(N.B. you'll need gir1.2-appindicator3-0.1 and gir1.2-notify-0.7 at the moment due to a bug in defining its dependencies.)

Once you have it installed and running, it should create an entry in the menubar or panel. You can manually prevent suspension, or set caffeine to activate automatically based on what processes are running. In your case, you can whitelist the installation program, such as apt-get. (I'm not sure what that is specifically, since you didn't provide the details.)

enter image description here

N.B. I'm using Kubuntu, where it works well. It should also work in Unity.


Update

New versions of caffeine have been crippled, and much of this functionality has been removed.. I think the old version (2.5) still works, though, so you can try that.

1
  • Hm… I read the OP before edits, and now I'm not sure if the "automatic activation" function of caffeine is useful, given that you don't want to prevent suspension when Virtualbox or the web browser is running, just when something specific is happening. In any case, you can just use caffeine's manual function, as a quick way to prevent suspension (when you remember!).
    – Sparhawk
    Mar 9, 2013 at 1:22
3

How to disabled the Suspend function, even if a program is running or not:

You have to goto the System Configuration and then click on Energy option. Now you should see an image similar than this one: energy

Then you will see the option called Suspend when inactive for and put this one on Don't Suspend, as you see on the previously image.

1

I do solve such things automating keyboard or mouse with xdotool package, using it in a dead-simple loop inside a terminal.

Is known that there are other software alternatives that send keyboard key F13 as non-intrusive alternative because that key exists but is not truly present for us.

You can send relative mouse movement with 0 values, so the input is sent, but the mouse is not perturbed.

while true; do xdotool mousemove_relative 0 0 && sleep 30; done

In short, what keeps your computer "alive" is the INPUT events.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .